Skip to content

Commit

Permalink
Merge pull request #246 from curvefi/feat/router-llammas
Browse files Browse the repository at this point in the history
Feat: llammas in router
  • Loading branch information
Macket authored Dec 18, 2023
2 parents 1f10e5c + 81c5a37 commit 973f4a2
Show file tree
Hide file tree
Showing 3 changed files with 133 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@curvefi/api",
"version": "2.53.4",
"version": "2.53.5",
"description": "JavaScript library for curve.fi",
"main": "lib/index.js",
"author": "Macket",
Expand Down
130 changes: 130 additions & 0 deletions src/constants/pools/ethereum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1705,4 +1705,134 @@ export const LLAMMAS_DATA_ETHEREUM: IDict<IPoolData> = lowerCasePoolDataAddresse
swap_abi: LlammaABI,
gauge_abi: gaugeV5ABI,
},
"wsteth-llamma": {
name: "wsteth",
full_name: "wsteth",
symbol: "wsteth",
reference_asset: "CRYPTO",
swap_address: '0x37417b2238aa52d0dd2d6252d989e728e8f706e4',
token_address: '0x0000000000000000000000000000000000000000',
gauge_address: '0x0000000000000000000000000000000000000000',
is_crypto: true,
is_plain: true,
is_llamma: true,
underlying_coins: ['crvUSD', 'wstETH'],
wrapped_coins: ['crvUSD', 'wstETH'],
underlying_coin_addresses: [
'0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E',
'0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0',
],
wrapped_coin_addresses: [
'0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E',
'0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0',
],
underlying_decimals: [18, 18],
wrapped_decimals: [18, 18],
swap_abi: LlammaABI,
gauge_abi: gaugeV5ABI,
},
"wbtc-llamma": {
name: "wbtc",
full_name: "wbtc",
symbol: "wbtc",
reference_asset: "CRYPTO",
swap_address: '0xe0438eb3703bf871e31ce639bd351109c88666ea',
token_address: '0x0000000000000000000000000000000000000000',
gauge_address: '0x0000000000000000000000000000000000000000',
is_crypto: true,
is_plain: true,
is_llamma: true,
underlying_coins: ['crvUSD', 'WBTC'],
wrapped_coins: ['crvUSD', 'WBTC'],
underlying_coin_addresses: [
'0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E',
'0x2260fac5e5542a773aa44fbcfedf7c193bc2c599',
],
wrapped_coin_addresses: [
'0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E',
'0x2260fac5e5542a773aa44fbcfedf7c193bc2c599',
],
underlying_decimals: [18, 8],
wrapped_decimals: [18, 8],
swap_abi: LlammaABI,
gauge_abi: gaugeV5ABI,
},
"weth-llamma": {
name: "weth",
full_name: "weth",
symbol: "weth",
reference_asset: "CRYPTO",
swap_address: '0x1681195c176239ac5e72d9aebacf5b2492e0c4ee',
token_address: '0x0000000000000000000000000000000000000000',
gauge_address: '0x0000000000000000000000000000000000000000',
is_crypto: true,
is_plain: true,
is_llamma: true,
underlying_coins: ['crvUSD', 'WETH'],
wrapped_coins: ['crvUSD', 'WETH'],
underlying_coin_addresses: [
'0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E',
'0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
],
wrapped_coin_addresses: [
'0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E',
'0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2',
],
underlying_decimals: [18, 18],
wrapped_decimals: [18, 18],
swap_abi: LlammaABI,
gauge_abi: gaugeV5ABI,
},
"sfrxeth2-llamma": {
name: "sfrxeth2",
full_name: "sfrxeth2",
symbol: "sfrxeth2",
reference_asset: 'CRYPTO',
swap_address: '0xfa96ad0a9e64261db86950e2da362f5572c5c6fd',
token_address: '0x0000000000000000000000000000000000000000',
gauge_address: '0x0000000000000000000000000000000000000000',
is_crypto: true,
is_plain: true,
is_llamma: true,
underlying_coins: ['crvUSD', 'sfrxETH'],
wrapped_coins: ['crvUSD', 'sfrxETH'],
underlying_coin_addresses: [
'0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E',
'0xac3E018457B222d93114458476f3E3416Abbe38F',
],
wrapped_coin_addresses: [
'0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E',
'0xac3E018457B222d93114458476f3E3416Abbe38F',
],
underlying_decimals: [18, 18],
wrapped_decimals: [18, 18],
swap_abi: LlammaABI,
gauge_abi: gaugeV5ABI,
},
"tbtc-llamma": {
name: "tbtc",
full_name: "tbtc",
symbol: "tbtc",
reference_asset: "CRYPTO",
swap_address: '0xf9bd9da2427a50908c4c6d1599d8e62837c2bcb0',
token_address: '0x0000000000000000000000000000000000000000',
gauge_address: '0x0000000000000000000000000000000000000000',
is_crypto: true,
is_plain: true,
is_llamma: true,
underlying_coins: ['crvUSD', 'tBTC'],
wrapped_coins: ['crvUSD', 'tBTC'],
underlying_coin_addresses: [
'0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E',
'0x18084fba666a33d37592fa2633fd49a74dd93a88',
],
wrapped_coin_addresses: [
'0xf939E0A03FB07F59A73314E73794Be0E57ac1b4E',
'0x18084fba666a33d37592fa2633fd49a74dd93a88',
],
underlying_decimals: [18, 18],
wrapped_decimals: [18, 18],
swap_abi: LlammaABI,
gauge_abi: gaugeV5ABI,
},
});
4 changes: 2 additions & 2 deletions src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ const _buildRouteGraph = memoize(async (): Promise<IDict<IDict<IRouteStep[]>>> =
}
}

const ALL_POOLS = Object.entries(curve.getPoolsData()).filter(([id, _]) => id !== "crveth");
const ALL_POOLS = Object.entries(curve.getPoolsData()).filter(([id, _]) => !["crveth", "y", "busd", "pax"].includes(id));
const amplificationCoefficientDict = await _getAmplificationCoefficientsFromApi();
for (const [poolId, poolData] of ALL_POOLS) {
const wrappedCoinAddresses = poolData.wrapped_coin_addresses.map((a: string) => a.toLowerCase());
Expand Down Expand Up @@ -260,7 +260,7 @@ const _buildRouteGraph = memoize(async (): Promise<IDict<IDict<IRouteStep[]>>> =
if (curve.chainId === 1 && tvl < 1000) continue;
if (curve.chainId !== 1 && tvl < 100) continue;

const excludedUnderlyingSwaps = (poolId === 'aave' && curve.chainId === 1) || (poolId === 'geist' && curve.chainId === 250);
const excludedUnderlyingSwaps = (poolId === 'ib' && curve.chainId === 1) || (poolId === 'geist' && curve.chainId === 250);

// Wrapped coin <-> LP "swaps" (actually add_liquidity/remove_liquidity_one_coin)
if (!poolData.is_fake && !poolData.is_llamma && wrappedCoinAddresses.length < 6) {
Expand Down

0 comments on commit 973f4a2

Please sign in to comment.