Compare commits

..

40 Commits

Author SHA1 Message Date
Noah Khamliche
5ae24b5211 fixed mobius celo pools 2022-02-02 14:52:17 -05:00
Noah Khamliche
0a08a44aa1 setting up asset swapper 2022-01-31 13:52:18 -05:00
Noah Khamliche
a1b21c9b70 added initial support for celo 2022-01-24 15:47:37 -05:00
Github Actions
dd96eef3aa Publish
- @0x/asset-swapper@16.46.0
2022-01-24 15:47:26 -05:00
Github Actions
16a40d845c Updated CHANGELOGS & MD docs 2022-01-24 15:47:25 -05:00
Jacob Evans
b36b1013d1 chore: Enable Curve ETH/CVX (#394)
* chore: Enable Curve ETH/CVX

* pr number
2022-01-24 15:47:25 -05:00
Github Actions
6d3de3f981 Publish
- @0x/asset-swapper@16.45.2
2022-01-24 15:47:25 -05:00
Github Actions
6b902cf94c Updated CHANGELOGS & MD docs 2022-01-24 15:47:25 -05:00
Kim Persson
6a7573d721 fix: don't create fills for 0 output samples and negative adjusted rate orders (#387)
* fix: don't try to create fills for 0 output samples

* fix: negative adjusted output native orders causing undefined fills

* fix: make sure to use the same sourcePathId for fills from same source

* fix: should be same sourcePathId within the same DexSample[]

* fix: split native orders into 13 samples to align with interpolation

* chore: add changelog entry for asset-swapper
2022-01-24 15:47:25 -05:00
Github Actions
e5bdbb8a58 Publish
- @0x/asset-swapper@16.45.1
2022-01-24 15:47:25 -05:00
Github Actions
4f8b1adee4 Updated CHANGELOGS & MD docs 2022-01-24 15:47:25 -05:00
Jacob Evans
2696359f33 chore: Celo Update certain tokens since Optics v2 (#390)
* chore: Celo Update certain tokens since Optics v2

* Changelog
2022-01-24 15:47:22 -05:00
Oskar Paolini
278edb73af fixes axios object dumping in logs (#345) 2022-01-24 15:47:11 -05:00
Github Actions
d2a3dd371a Publish
- @0x/asset-swapper@16.45.0
2022-01-24 15:47:11 -05:00
Github Actions
9f5b35bcec Updated CHANGELOGS & MD docs 2022-01-24 15:47:11 -05:00
Jacob Evans
242df31584 feat: Capture Routing timing metrics (#388) 2022-01-24 15:47:11 -05:00
Github Actions
837f36d74c Publish
- @0x/asset-swapper@16.44.0
2022-01-24 15:47:10 -05:00
Github Actions
710e19559c Updated CHANGELOGS & MD docs 2022-01-24 15:47:10 -05:00
Kim Persson
87905fd122 feat: Udate neon-router and use router estimated output amount (#354)
* feat: use Rust router estimated output amount when possible

* fix: use strings for sample ids, and increase samples in the rust router

* fix: remove unnecessary interpolation of out of range values

* fix: don't recalculate sampled dist sum in a loop

* fix: use 14 samples for rust router to work around interpolation issues

* fix: unintentional logic change

* fix: remove local dev plotting param from route fn call

* feat: make neon-router number of samples configurable

* chore: bump to newly published neon-router version

* fix: handle insufficient liquidity at all requested sources

* chore: update asset-swapper changelog
2022-01-24 15:47:10 -05:00
Github Actions
dac22c20ce Publish
- @0x/contracts-erc20@3.3.25
 - @0x/contracts-test-utils@5.4.16
 - @0x/contracts-treasury@1.4.8
 - @0x/contracts-utils@4.8.6
 - @0x/contracts-zero-ex@0.30.1
 - @0x/asset-swapper@16.43.0
 - @0x/contract-addresses@6.11.0
 - @0x/contract-wrappers@13.18.5
 - @0x/migrations@8.1.14
 - @0x/protocol-utils@1.10.1
2022-01-24 15:47:10 -05:00
Github Actions
3b93c295d1 Updated CHANGELOGS & MD docs 2022-01-24 15:47:10 -05:00
Shawn
6e2692a576 feat/optimism [TKR-280] (#385)
* rebase and remove WIP Clipper new weth router test

* remove clipper test

* restore from clipper test

* add uniswapV3 on optimism

* modify token addresses and add EP-related addresses on optimism

* prettier

* modify CHANGLOG.json

* convert addresses to lowercase

* remove testnet addresses

Co-authored-by: Romain Butteaud <romain.butteaud@gmail.com>
2022-01-24 15:47:10 -05:00
Github Actions
dfeb3929b7 Publish
- @0x/asset-swapper@16.42.0
2022-01-24 15:47:09 -05:00
Github Actions
42de461906 Updated CHANGELOGS & MD docs 2022-01-24 15:47:09 -05:00
Jacob Evans
e872d72e8c fix: Beethovenx graphql endpoint (#383) 2022-01-24 15:47:09 -05:00
Jacob Evans
7e340c6f42 fix: PR number in CHANGELOG 2022-01-24 15:47:09 -05:00
Jacob Evans
448c33c534 feat: UniswapV3 on Polygon (#382) 2022-01-24 15:47:09 -05:00
Github Actions
87839f75c6 Publish
- @0x/asset-swapper@16.41.0
2022-01-24 15:47:09 -05:00
Github Actions
3759c4a5c6 Updated CHANGELOGS & MD docs 2022-01-24 15:47:09 -05:00
Noah Khamliche
476988c64a Sushi router celo fix (#376)
* Updated Sushiswap router on CELO

Sushi address in the docs was incorrect, this is the correct address `0x1421bDe4B10e8dd459b3BCb598810B1337D56842`.

* address to lowercase

* Update CHANGELOG.json

* fixed sushi router address, replaced celo ref with wcelo, fixed mcusd address

* celo->wcelo

* Update packages/asset-swapper/CHANGELOG.json

Co-authored-by: Jacob Evans <jacob@dekz.net>

* changelog

* version bump

Co-authored-by: Jacob Evans <jacob@dekz.net>
2022-01-24 15:47:05 -05:00
Github Actions
0205bc24f6 Publish
- @0x/contracts-erc20@3.3.24
 - @0x/contracts-test-utils@5.4.15
 - @0x/contracts-treasury@1.4.7
 - @0x/contracts-utils@4.8.5
 - @0x/contracts-zero-ex@0.30.0
 - @0x/asset-swapper@16.40.0
 - @0x/contract-addresses@6.10.0
 - @0x/contract-wrappers@13.18.4
 - @0x/migrations@8.1.13
 - @0x/protocol-utils@1.10.0
2022-01-24 15:46:31 -05:00
Github Actions
06644ca366 Updated CHANGELOGS & MD docs 2022-01-24 15:46:31 -05:00
Kim Persson
8a5881400c feat: deploy interest tokens (#321)
* feat: Aave aToken deposit/withdrawal [TKR-111] (#293)

* feat: AaveV2 deposit/withdrawal integration WIP

* feat: add basic Aave Reserves cache with data from subgraphs WIP

* feat: hook up Aave Reserves integration

* fix: set allowance before trade & use ERC20 token interface

* refactor: pass aToken to mixin to avoid lookup

* fix: migrate from swap/revert to normal sampling

* fix: Aave gas estimate & refactor to clean up code

* feat: Create a sampler no operation type and make AaveV2Sampler a no-op

* fix: Clipper merge conflict resolution issues

* fix: don't fetch unnecessary Aave pool data & clean up code

* chore: Add changelog entries

* feat: cToken deposit/withdrawal [TKR-222] (#294)

* feat: first stab at a CompoundSampler implementation

* feat: MixinCompound implementation WIP

* feat: Compound integration with cache WIP

* fix: decimals scaling in CompoundSampler

* feat: handle minting and redeeming of cETH

* fix: adjust Compound gas schedule

* refactor: clean up code and add comments in cToken cache

* fix: MixinCompound check allowance on WETH withdrawal & fix indentation

* fix: address review comments and clean up code

* chore: add changelog entries

* feat: enable AaveV2 on Avalanche

* chore: add freshly deployed FQT on Polygon, Avalanche

* fix: temporarily disable on Ethereum mainnet until we redeploy EP

* fix: address PR comments and update changelogs

* fix: correct contract-addresses changelog note
2022-01-24 15:46:31 -05:00
Jacob Evans
30ae0c56ca chore: Curve added ETH/CRV pool (#378) 2022-01-24 15:46:31 -05:00
Jacob Evans
4b402916c8 Revert "chore: Curve added ETH/CRV pool"
This reverts commit 90b441330b.
2022-01-24 15:46:30 -05:00
Jacob Evans
349766a761 chore: Curve added ETH/CRV pool 2022-01-24 15:46:30 -05:00
Github Actions
a57b66ccbd Publish
- @0x/asset-swapper@16.38.0
2022-01-24 15:46:30 -05:00
Github Actions
f49b07e76b Updated CHANGELOGS & MD docs 2022-01-24 15:46:30 -05:00
Jacob Evans
44a47dd233 chore: Add ability to capture sampler metrics (#374)
* chore: Add ability to capture sampler metrics

* Added block number metrics
2022-01-24 15:46:30 -05:00
Noah Khamliche
70a4119b89 added initial support for celo 2022-01-24 14:53:34 -05:00
8 changed files with 266 additions and 5 deletions

View File

@@ -1,4 +1,14 @@
[
{
"version": "16.46.0",
"changes": [
{
"note": "Enable `Curve` ETH/CVX pool",
"pr": 394
}
],
"timestamp": 1641863395
},
{
"version": "16.45.2",
"changes": [

View File

@@ -5,6 +5,10 @@ Edit the package's CHANGELOG.json file only.
CHANGELOG
## v16.46.0 - _January 11, 2022_
* Enable `Curve` ETH/CVX pool (#394)
## v16.45.2 - _January 10, 2022_
* Handle 0 output samples and negative adjusted rate native orders in routing (#387)

View File

@@ -1,6 +1,6 @@
{
"name": "@0x/asset-swapper",
"version": "16.45.2",
"version": "16.46.0",
"engines": {
"node": ">=6.12"
},

View File

@@ -54,6 +54,7 @@ import {
UNISWAPV2_ROUTER_BY_CHAIN_ID,
WAULTSWAP_ROUTER_BY_CHAIN_ID,
XSIGMA_MAINNET_INFOS,
MOBIUS_CELO_INFOS,
} from './constants';
import { CurveInfo, ERC20BridgeSource } from './types';
@@ -247,6 +248,19 @@ export function getNerveInfosForPair(chainId: ChainId, takerToken: string, maker
);
}
export function getMobiusInfoForPair(chainId: ChainId, takerToken: string, makerToken: string): CurveInfo[] {
if (chainId !== ChainId.Celo) {
return [];
}
return Object.values(MOBIUS_CELO_INFOS).filter(c =>
[makerToken, takerToken].every(
t =>
(c.tokens.includes(t) && c.metaTokens === undefined) ||
(c.tokens.includes(t) && [makerToken, takerToken].filter(v => c.metaTokens?.includes(v)).length > 0),
),
);
}
export function getFirebirdOneSwapInfosForPair(chainId: ChainId, takerToken: string, makerToken: string): CurveInfo[] {
if (chainId === ChainId.BSC) {
return Object.values(FIREBIRDONESWAP_BSC_INFOS).filter(c =>
@@ -413,7 +427,8 @@ export function getCurveLikeInfosForPair(
| ERC20BridgeSource.IronSwap
| ERC20BridgeSource.XSigma
| ERC20BridgeSource.FirebirdOneSwap
| ERC20BridgeSource.ACryptos,
| ERC20BridgeSource.ACryptos
| ERC20BridgeSource.MobiusMoney,
): CurveDetailedInfo[] {
let pools: CurveInfo[] = [];
switch (source) {
@@ -456,6 +471,9 @@ export function getCurveLikeInfosForPair(
case ERC20BridgeSource.ACryptos:
pools = getAcryptosInfosForPair(chainId, takerToken, makerToken);
break;
case ERC20BridgeSource.MobiusMoney:
pools = getMobiusInfoForPair(chainId, takerToken, makerToken);
break;
default:
throw new Error(`Unknown Curve like source ${source}`);
}

View File

@@ -193,6 +193,7 @@ export const SELL_SOURCE_FILTER_BY_CHAIN_ID = valueByChainId<SourceFilters>(
ERC20BridgeSource.UbeSwap,
ERC20BridgeSource.SushiSwap,
ERC20BridgeSource.MultiHop,
ERC20BridgeSource.MobiusMoney,
]),
[ChainId.Optimism]: new SourceFilters([ERC20BridgeSource.UniswapV3]),
},
@@ -323,6 +324,7 @@ export const BUY_SOURCE_FILTER_BY_CHAIN_ID = valueByChainId<SourceFilters>(
ERC20BridgeSource.SushiSwap,
]),
[ChainId.Celo]: new SourceFilters([
ERC20BridgeSource.MobiusMoney,
ERC20BridgeSource.UbeSwap,
ERC20BridgeSource.SushiSwap,
ERC20BridgeSource.MultiHop,
@@ -462,6 +464,7 @@ export const MAINNET_TOKENS = {
CRV: '0xd533a949740bb3306d119cc777fa900ba034cd52',
MIM: '0x99d8a9c45b2eca8864373a26d1459e3dff1e17f3',
EURT: '0xc581b735a1688071a1746c968e0798d642ede491',
CVX: '0x4e3fbd56cd56c3e72c1403e103b45db9da5b9d2b',
};
export const BSC_TOKENS = {
@@ -513,7 +516,7 @@ export const CELO_TOKENS = {
WCELO: '0x471ece3750da237f93b8e339c536989b8978a438',
// Some of these tokens are Optics bridge? tokens which
// had an issue and migrated from v1 to v2
WETHv1: '0xe919f65739c26a42616b7b8eedc6b5524d1e3ac4',
//WETHv1: '0xe919f65739c26a42616b7b8eedc6b5524d1e3ac4',
WETH: '0x122013fd7df1c6f636a5bb8f03108e876548b455',
WBTC: '0xbaab46e28388d2779e6e31fd00cf0e5ad95e327b',
cUSD: '0x765de816845861e75a25fca122bb6898b8b1282a',
@@ -527,6 +530,29 @@ export const CELO_TOKENS = {
mCEUR: '0xe273ad7ee11dcfaa87383ad5977ee1504ac07568',
amCUSD: '0x64defa3544c695db8c535d289d843a189aa26b98',
MOO: '0x17700282592d6917f6a73d0bf8accf4d578c131e',
//Mobius Money
WETHv1: '0xe919f65739c26a42616b7b8eedc6b5524d1e3ac4',
CELO: '0x471ece3750da237f93b8e339c536989b8978a438',
mCUSDm: '0x64defa3544c695db8c535d289d843a189aa26b98',
wBTC: '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599',
wETH: '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2',
wBTCO: '0xbe50a3013a1c94768a1abb78c3cb79ab28fc1ace',
pUSDCxV1: '0xcc82628f6a8defa1e2b0ad7ed448bef3647f7941',
cUSDC: '0x2a3684e9dc20b857375ea04235f2f7edbe818fa7',
cUSDC_V2: '0xef4229c8c3250c675f21bcefa42f58efbff6002a',
pUSDC_V2: '0x1bfc26ce035c368503fae319cc2596716428ca44',
wBTC_V2: '0xbaabl46e28388d2779e6e31fd00cf0e5ad95e327b',
cUSDTm: '0xcfffe0c89a779c09df3df5624f54cdf7ef5fdd5d',
cUSDCm: '0x93db49be12b864019da9cb147ba75cdc0506190e',
cBTC: '0xd629eb00deced2a080b7ec630ef6ac117e614f1b',
asUSDC: '0xcd7d7ff64746c1909e44db8e95331f9316478817',
aaUSDC: '0xb70e0a782b058bfdb0d109a3599bec1f19328e36',
pUSDC: '0x1bfc26ce035c368503fae319cc2596716428ca44',
oWETH: '0x122013fd7df1c6f636a5bb8f03108e876548b455',
oDAI: '0x90ca507a5d4458a4c6c6249d186b6dcb02a5bccd',
pCELO: '0x301a61d01a63c8d670c2b8a43f37d12ef181f997',
pUSD: '0xeadf4a7168a82d30ba0619e64d5bcf5b30b45226',
};
export const FANTOM_TOKENS = {
@@ -592,6 +618,7 @@ export const CURVE_POOLS = {
mim: '0x5a6a4d54456819380173272a5e8e9b9904bdf41b',
eurt: '0xfd5db7463a3ab53fd211b4af195c5bccc1a03890',
ethcrv: '0x8301ae4fc9c624d1d396cbdaa1ed877821d7c511',
ethcvx: '0xb576491f1e6e5e62f1d8f26062ee822b40b0e0d4',
};
export const CURVE_V2_POOLS = {
@@ -661,6 +688,24 @@ export const NERVE_POOLS = {
threePool: '0x1b3771a66ee31180906972580ade9b81afc5fcdc',
};
export const MOBIUS_CELO_POOLS = {
poof_cusd_v2: '0xa2f0e57d4ceacf025e81c76f28b9ad6e9fbe8735',
poof_celo_v2: '0xfc9e2c63370d8deb3521922a7b2b60f4cff7e75a',
usdc_optics_v2: '0x9906589ea8fd27504974b7e8201df5bbde986b03',
dai_optics_v2: '0xf3f65dfe0c8c8f2986da0fec159abe6fd4e700b4',
weth_optics_v2: '0x74ef28d635c6c5800dd3cd62d4c4f8752daacb09',
wbtc_optics_v2: '0xaefc4e8cf655a182e8346b24c8abce45616ee0d2',
pusdc_optics_v2: '0xcce0d62ce14fb3e4363eb92db37ff3630836c252',
usdc_allbridge_avax: '0x0986b42f5f9c42feeef66fc23eba9ea1164c916d',
usdc_allbridge_solana: '0x63c1914bf00a9b395a2bf89aada55a5615a3656e',
usdc_eth_optics: '0xa5037661989789d0310ac2b796fa78f1b01f195d',
usdc_poly_optics: '0x2080aaa167e2225e1fc9923250ba60e19a180fb2',
wbtc: '0x19260b9b573569ddb105780176547875fe9feda3',
weth: '0xe0f2cc70e52f05edb383313393d88df2937da55a',
usdt_moss: '0xdbf27fd2a702cc02ac7acf0aea376db780d53247',
usdc_moss: '0x0ff04189Ef135b6541E56f7C638489De92E9c778',
};
export const BELT_POOLS = {
vPool: '0xf16d312d119c13dd27fd0dc814b0bcdcaaa62dfd',
};
@@ -727,7 +772,34 @@ export const DEFAULT_INTERMEDIATE_TOKENS_BY_CHAIN_ID = valueByChainId<string[]>(
AVALANCHE_TOKENS.USDC,
],
[ChainId.Fantom]: [FANTOM_TOKENS.WFTM, FANTOM_TOKENS.WETH, FANTOM_TOKENS.DAI, FANTOM_TOKENS.USDC],
[ChainId.Celo]: [CELO_TOKENS.WCELO, CELO_TOKENS.mCUSD, CELO_TOKENS.WETH, CELO_TOKENS.amCUSD, CELO_TOKENS.WBTC],
[ChainId.Celo]: [
CELO_TOKENS.WCELO,
CELO_TOKENS.mCUSD,
CELO_TOKENS.WETH,
CELO_TOKENS.amCUSD,
CELO_TOKENS.WBTC,
CELO_TOKENS.WETHv1,
CELO_TOKENS.CELO,
CELO_TOKENS.mCUSDm,
CELO_TOKENS.wBTC,
CELO_TOKENS.wETH,
CELO_TOKENS.wBTCO,
CELO_TOKENS.pUSDCxV1,
CELO_TOKENS.cUSDC,
CELO_TOKENS.cUSDC_V2,
CELO_TOKENS.pUSDC_V2,
CELO_TOKENS.wBTC_V2,
CELO_TOKENS.cUSDTm,
CELO_TOKENS.cUSDCm,
CELO_TOKENS.cBTC,
CELO_TOKENS.asUSDC,
CELO_TOKENS.aaUSDC,
CELO_TOKENS.pUSDC,
CELO_TOKENS.oWETH,
CELO_TOKENS.oDAI,
CELO_TOKENS.pCELO,
CELO_TOKENS.pUSD,
],
[ChainId.Optimism]: [OPTIMISM_TOKENS.WETH, OPTIMISM_TOKENS.DAI, OPTIMISM_TOKENS.USDC],
},
[],
@@ -1073,6 +1145,17 @@ export const CURVE_MAINNET_INFOS: { [name: string]: CurveInfo } = {
sellQuoteFunctionSelector: CurveFunctionSelectors.get_dy_uint256,
exchangeFunctionSelector: CurveFunctionSelectors.exchange_underlying_uint256,
},
[CURVE_POOLS.ethcvx]: {
...createCurveExchangePool({
// This pool uses ETH
tokens: [MAINNET_TOKENS.WETH, MAINNET_TOKENS.CVX],
pool: CURVE_POOLS.ethcvx,
gasSchedule: 350e3,
}),
// This pool has a custom get_dy and exchange selector with uint256
sellQuoteFunctionSelector: CurveFunctionSelectors.get_dy_uint256,
exchangeFunctionSelector: CurveFunctionSelectors.exchange_underlying_uint256,
},
};
export const CURVE_V2_MAINNET_INFOS: { [name: string]: CurveInfo } = {
@@ -1330,6 +1413,144 @@ export const NERVE_BSC_INFOS: { [name: string]: CurveInfo } = {
},
};
export const MOBIUS_CELO_INFOS: { [name: string]: CurveInfo } = {
[MOBIUS_CELO_POOLS.poof_cusd_v2]: {
exchangeFunctionSelector: CurveFunctionSelectors.swap,
sellQuoteFunctionSelector: CurveFunctionSelectors.calculateSwap,
buyQuoteFunctionSelector: CurveFunctionSelectors.None,
poolAddress: MOBIUS_CELO_POOLS.poof_cusd_v2,
tokens: [CELO_TOKENS.cUSD, CELO_TOKENS.pUSD],
metaTokens: undefined,
gasSchedule: 140e3,
},
[MOBIUS_CELO_POOLS.poof_celo_v2]: {
exchangeFunctionSelector: CurveFunctionSelectors.swap,
sellQuoteFunctionSelector: CurveFunctionSelectors.calculateSwap,
buyQuoteFunctionSelector: CurveFunctionSelectors.None,
poolAddress: MOBIUS_CELO_POOLS.poof_celo_v2,
tokens: [CELO_TOKENS.CELO, CELO_TOKENS.pCELO],
metaTokens: undefined,
gasSchedule: 140e3,
},
[MOBIUS_CELO_POOLS.usdc_optics_v2]: {
exchangeFunctionSelector: CurveFunctionSelectors.swap,
sellQuoteFunctionSelector: CurveFunctionSelectors.calculateSwap,
buyQuoteFunctionSelector: CurveFunctionSelectors.None,
poolAddress: MOBIUS_CELO_POOLS.usdc_optics_v2,
tokens: [CELO_TOKENS.cUSD, CELO_TOKENS.cUSDC_V2],
metaTokens: undefined,
gasSchedule: 140e3,
},
[MOBIUS_CELO_POOLS.dai_optics_v2]: {
exchangeFunctionSelector: CurveFunctionSelectors.swap,
sellQuoteFunctionSelector: CurveFunctionSelectors.calculateSwap,
buyQuoteFunctionSelector: CurveFunctionSelectors.None,
poolAddress: MOBIUS_CELO_POOLS.dai_optics_v2,
tokens: [CELO_TOKENS.cUSD, CELO_TOKENS.oDAI],
metaTokens: undefined,
gasSchedule: 140e3,
},
[MOBIUS_CELO_POOLS.wbtc_optics_v2]: {
exchangeFunctionSelector: CurveFunctionSelectors.swap,
sellQuoteFunctionSelector: CurveFunctionSelectors.calculateSwap,
buyQuoteFunctionSelector: CurveFunctionSelectors.None,
poolAddress: MOBIUS_CELO_POOLS.wbtc_optics_v2,
tokens: [CELO_TOKENS.cBTC, CELO_TOKENS.wBTC_V2],
metaTokens: undefined,
gasSchedule: 140e3,
},
[MOBIUS_CELO_POOLS.weth_optics_v2]: {
exchangeFunctionSelector: CurveFunctionSelectors.swap,
sellQuoteFunctionSelector: CurveFunctionSelectors.calculateSwap,
buyQuoteFunctionSelector: CurveFunctionSelectors.None,
poolAddress: MOBIUS_CELO_POOLS.weth_optics_v2,
tokens: [CELO_TOKENS.cETH, CELO_TOKENS.oWETH],
metaTokens: undefined,
gasSchedule: 140e3,
},
[MOBIUS_CELO_POOLS.pusdc_optics_v2]: {
exchangeFunctionSelector: CurveFunctionSelectors.swap,
sellQuoteFunctionSelector: CurveFunctionSelectors.calculateSwap,
buyQuoteFunctionSelector: CurveFunctionSelectors.None,
poolAddress: MOBIUS_CELO_POOLS.pusdc_optics_v2,
tokens: [CELO_TOKENS.cUSD, CELO_TOKENS.pUSDC],
metaTokens: undefined,
gasSchedule: 140e3,
},
[MOBIUS_CELO_POOLS.usdc_allbridge_avax]: {
exchangeFunctionSelector: CurveFunctionSelectors.swap,
sellQuoteFunctionSelector: CurveFunctionSelectors.calculateSwap,
buyQuoteFunctionSelector: CurveFunctionSelectors.None,
poolAddress: MOBIUS_CELO_POOLS.usdc_allbridge_avax,
tokens: [CELO_TOKENS.cUSD, CELO_TOKENS.aaUSDC],
metaTokens: undefined,
gasSchedule: 140e3,
},
[MOBIUS_CELO_POOLS.usdc_allbridge_solana]: {
exchangeFunctionSelector: CurveFunctionSelectors.swap,
sellQuoteFunctionSelector: CurveFunctionSelectors.calculateSwap,
buyQuoteFunctionSelector: CurveFunctionSelectors.None,
poolAddress: MOBIUS_CELO_POOLS.usdc_allbridge_solana,
tokens: [CELO_TOKENS.cUSD, CELO_TOKENS.asUSDC],
metaTokens: undefined,
gasSchedule: 140e3,
},
[MOBIUS_CELO_POOLS.usdc_eth_optics]: {
exchangeFunctionSelector: CurveFunctionSelectors.swap,
sellQuoteFunctionSelector: CurveFunctionSelectors.calculateSwap,
buyQuoteFunctionSelector: CurveFunctionSelectors.None,
poolAddress: MOBIUS_CELO_POOLS.usdc_eth_optics,
tokens: [CELO_TOKENS.cUSD, CELO_TOKENS.cUSDC],
metaTokens: undefined,
gasSchedule: 140e3,
},
[MOBIUS_CELO_POOLS.usdc_poly_optics]: {
exchangeFunctionSelector: CurveFunctionSelectors.swap,
sellQuoteFunctionSelector: CurveFunctionSelectors.calculateSwap,
buyQuoteFunctionSelector: CurveFunctionSelectors.None,
poolAddress: MOBIUS_CELO_POOLS.usdc_poly_optics,
tokens: [CELO_TOKENS.cUSD, CELO_TOKENS.pUSDCxV1],
metaTokens: undefined,
gasSchedule: 140e3,
},
[MOBIUS_CELO_POOLS.wbtc]: {
exchangeFunctionSelector: CurveFunctionSelectors.swap,
sellQuoteFunctionSelector: CurveFunctionSelectors.calculateSwap,
buyQuoteFunctionSelector: CurveFunctionSelectors.None,
poolAddress: MOBIUS_CELO_POOLS.wbtc,
tokens: [CELO_TOKENS.cBTC, CELO_TOKENS.wBTCO],
metaTokens: undefined,
gasSchedule: 140e3,
},
[MOBIUS_CELO_POOLS.weth]: {
exchangeFunctionSelector: CurveFunctionSelectors.swap,
sellQuoteFunctionSelector: CurveFunctionSelectors.calculateSwap,
buyQuoteFunctionSelector: CurveFunctionSelectors.None,
poolAddress: MOBIUS_CELO_POOLS.weth,
tokens: [CELO_TOKENS.cETH, CELO_TOKENS.WETHv1],
metaTokens: undefined,
gasSchedule: 140e3,
},
[MOBIUS_CELO_POOLS.usdc_moss]: {
exchangeFunctionSelector: CurveFunctionSelectors.swap,
sellQuoteFunctionSelector: CurveFunctionSelectors.calculateSwap,
buyQuoteFunctionSelector: CurveFunctionSelectors.None,
poolAddress: MOBIUS_CELO_POOLS.usdc_moss,
tokens: [CELO_TOKENS.cUSD, CELO_TOKENS.cUSDCm],
metaTokens: undefined,
gasSchedule: 140e3,
},
[MOBIUS_CELO_POOLS.usdt_moss]: {
exchangeFunctionSelector: CurveFunctionSelectors.swap,
sellQuoteFunctionSelector: CurveFunctionSelectors.calculateSwap,
buyQuoteFunctionSelector: CurveFunctionSelectors.None,
poolAddress: MOBIUS_CELO_POOLS.usdc_moss,
tokens: [CELO_TOKENS.cUSD, CELO_TOKENS.cUSDTm],
metaTokens: undefined,
gasSchedule: 140e3,
},
};
export const FIREBIRDONESWAP_BSC_INFOS: { [name: string]: CurveInfo } = {
[FIREBIRDONESWAP_BSC_POOLS.oneswap]: {
exchangeFunctionSelector: CurveFunctionSelectors.swap,
@@ -1976,6 +2197,7 @@ export const DEFAULT_GAS_SCHEDULE: Required<FeeSchedule> = {
[ERC20BridgeSource.IronSwap]: fillData => (fillData as CurveFillData).pool.gasSchedule,
[ERC20BridgeSource.XSigma]: fillData => (fillData as CurveFillData).pool.gasSchedule,
[ERC20BridgeSource.FirebirdOneSwap]: fillData => (fillData as CurveFillData).pool.gasSchedule,
[ERC20BridgeSource.MobiusMoney]: fillData => (fillData as CurveFillData).pool.gasSchedule,
[ERC20BridgeSource.MultiBridge]: () => 350e3,
[ERC20BridgeSource.UniswapV2]: uniswapV2CloneGasSchedule,
[ERC20BridgeSource.SushiSwap]: uniswapV2CloneGasSchedule,

View File

@@ -134,6 +134,8 @@ export function getErc20BridgeSourceToBridgeSource(source: ERC20BridgeSource): s
return encodeBridgeSourceId(BridgeProtocol.UniswapV2, 'BakerySwap');
case ERC20BridgeSource.Nerve:
return encodeBridgeSourceId(BridgeProtocol.Nerve, 'Nerve');
case ERC20BridgeSource.MobiusMoney:
return encodeBridgeSourceId(BridgeProtocol.Nerve, 'MobiusMoney');
case ERC20BridgeSource.Belt:
return encodeBridgeSourceId(BridgeProtocol.Curve, 'Belt');
case ERC20BridgeSource.Ellipsis:
@@ -226,6 +228,7 @@ export function createBridgeDataForBridgeOrder(order: OptimizedMarketBridgeOrder
case ERC20BridgeSource.Swerve:
case ERC20BridgeSource.SnowSwap:
case ERC20BridgeSource.Nerve:
case ERC20BridgeSource.MobiusMoney:
case ERC20BridgeSource.Belt:
case ERC20BridgeSource.Ellipsis:
case ERC20BridgeSource.Smoothy:
@@ -471,6 +474,7 @@ export const BRIDGE_ENCODERS: {
[ERC20BridgeSource.FirebirdOneSwap]: curveEncoder,
[ERC20BridgeSource.IronSwap]: curveEncoder,
[ERC20BridgeSource.ACryptos]: curveEncoder,
[ERC20BridgeSource.MobiusMoney]: curveEncoder,
// UniswapV2 like, (router, address[])
[ERC20BridgeSource.Bancor]: routerAddressPathEncoder,
[ERC20BridgeSource.UniswapV2]: routerAddressPathEncoder,

View File

@@ -1349,6 +1349,7 @@ export class SamplerOperations {
case ERC20BridgeSource.FirebirdOneSwap:
case ERC20BridgeSource.IronSwap:
case ERC20BridgeSource.ACryptos:
case ERC20BridgeSource.MobiusMoney:
return getCurveLikeInfosForPair(this.chainId, takerToken, makerToken, source).map(pool =>
this.getCurveSellQuotes(
pool,
@@ -1654,6 +1655,7 @@ export class SamplerOperations {
case ERC20BridgeSource.FirebirdOneSwap:
case ERC20BridgeSource.IronSwap:
case ERC20BridgeSource.ACryptos:
case ERC20BridgeSource.MobiusMoney:
return getCurveLikeInfosForPair(this.chainId, takerToken, makerToken, source).map(pool =>
this.getCurveBuyQuotes(
pool,

View File

@@ -96,6 +96,7 @@ export enum ERC20BridgeSource {
TraderJoe = 'TraderJoe',
// Celo only
UbeSwap = 'UbeSwap',
MobiusMoney = 'Mobius',
// Fantom
SpiritSwap = 'SpiritSwap',
SpookySwap = 'SpookySwap',
@@ -130,7 +131,7 @@ export enum CurveFunctionSelectors {
// Smoothy
swap_uint256 = '0x5673b02d', // swap(uint256,uint256,uint256,uint256)
get_swap_amount = '0x45cf2ef6', // getSwapAmount(uint256,uint256,uint256)
// Nerve BSC, Saddle Mainnet
// Nerve BSC, Saddle Mainnet, Synapse all networks, Mobius Celo
swap = '0x91695586', // swap(uint8,uint8,uint256,uint256,uint256)
calculateSwap = '0xa95b089f', // calculateSwap(uint8,uint8,uint256)
}