From f4fcec9f262473a9d622f83802ea5b84f8791c9e Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Thu, 18 Jul 2024 17:39:23 +0300 Subject: [PATCH] remove unused code --- package-lock.json | 105 +- src/adapters/package-lock.json | 393 +++-- .../peggedAssets/binance-usd/index.ts | 2 +- src/adapters/peggedAssets/bob/index.ts | 64 +- .../bucket-protocol-buck-stablecoin/index.ts | 15 +- src/adapters/peggedAssets/dai/index.ts | 4 +- src/adapters/peggedAssets/frax/index.ts | 2 +- .../{llama-helper => helper}/algorand.js | 0 .../algorandUtils/address.js | 0 src/adapters/peggedAssets/helper/aptos.ts | 7 + src/adapters/peggedAssets/helper/getSupply.ts | 24 +- .../{llama-helper => helper}/http.js | 9 +- src/adapters/peggedAssets/helper/near.js | 25 + src/adapters/peggedAssets/helper/solana.js | 42 +- .../{llama-helper => helper}/starknet.js | 0 src/adapters/peggedAssets/helper/sui.ts | 27 +- src/adapters/peggedAssets/helper/terra.js | 3 - src/adapters/peggedAssets/helper/utils.js | 181 ++- .../peggedAssets/llama-helper/CosmWasm.js | 60 - .../peggedAssets/llama-helper/aave.js | 129 -- .../peggedAssets/llama-helper/abis/aave.json | 521 ------ .../llama-helper/abis/balancer.json | 44 - .../llama-helper/abis/blindex.json | 92 -- .../llama-helper/abis/brahmafi-aastra.json | 12 - .../llama-helper/abis/compound.json | 183 --- .../peggedAssets/llama-helper/abis/cream.json | 32 - .../peggedAssets/llama-helper/abis/dodo.json | 28 - .../peggedAssets/llama-helper/abis/erc20.json | 34 - .../llama-helper/abis/factory.json | 20 - .../abis/getEntireSystemColl.abi.json | 13 - .../llama-helper/abis/getPair.json | 26 - .../llama-helper/abis/getPricePerShare.json | 31 - .../llama-helper/abis/getReserves.json | 25 - .../llama-helper/abis/kashipair.json | 20 - .../llama-helper/abis/masterchef.json | 35 - .../llama-helper/abis/symbol.json | 15 - .../peggedAssets/llama-helper/abis/token.json | 14 - .../llama-helper/abis/token0.json | 15 - .../llama-helper/abis/token1.json | 15 - .../llama-helper/abis/userInfo.json | 27 - .../llama-helper/alchemixHelper.js | 186 --- .../llama-helper/ankr/abis/AethToken.json | 293 ---- .../llama-helper/ankr/abis/ERC20.json | 347 ---- .../llama-helper/ankr/abis/OnsToken.json | 602 ------- .../llama-helper/ankr/abis/OnxPool.json | 1402 ----------------- .../llama-helper/ankr/abis/OnxToken.json | 384 ----- .../llama-helper/ankr/abis/QuickswapPool.json | 345 ---- .../ankr/abis/QuickswapVault.json | 292 ---- .../llama-helper/ankr/abis/SOnxToken.json | 322 ---- .../ankr/abis/SpookyswapPool.json | 285 ---- .../ankr/abis/SpookyswapVault.json | 277 ---- .../llama-helper/ankr/abis/SushiswapPool.json | 285 ---- .../ankr/abis/SushiswapVault.json | 280 ---- .../llama-helper/ankr/abis/TraderJoePool.json | 285 ---- .../ankr/abis/TraderJoeVault.json | 284 ---- .../llama-helper/ankr/abis/UniswapV2Pair.json | 713 --------- .../llama-helper/ankr/abis/activePool.json | 13 - .../llama-helper/ankr/abis/wethAddress.json | 13 - .../llama-helper/ankr/chainAddresses.js | 9 - .../llama-helper/ankr/networks.js | 84 - .../llama-helper/ankr/prices/binance.js | 12 - .../peggedAssets/llama-helper/ankr/utils.js | 79 - .../peggedAssets/llama-helper/aptos.js | 14 - .../peggedAssets/llama-helper/arth.js | 47 - .../peggedAssets/llama-helper/balancer.js | 32 - .../peggedAssets/llama-helper/balances.js | 15 - .../llama-helper/brahmafi-aastra.js | 18 - .../llama-helper/calculateUniTvl.js | 179 --- .../peggedAssets/llama-helper/chains.json | 137 -- .../peggedAssets/llama-helper/compound.js | 332 ---- .../peggedAssets/llama-helper/curvePools.js | 390 ----- src/adapters/peggedAssets/llama-helper/eos.js | 73 - .../peggedAssets/llama-helper/exports.js | 33 - .../llama-helper/formatAddressChecksum.js | 17 - .../peggedAssets/llama-helper/getBlock.js | 20 - .../peggedAssets/llama-helper/getChainList.js | 96 -- .../llama-helper/getEfficientUsdUniTvl.js | 176 --- .../peggedAssets/llama-helper/getTokens.js | 16 - .../llama-helper/getUniFactory.js | 20 - .../llama-helper/getUniSubgraphTvl.js | 77 - .../peggedAssets/llama-helper/getUsdUniTvl.js | 303 ---- .../peggedAssets/llama-helper/graph.js | 23 - .../peggedAssets/llama-helper/hbar.js | 22 - .../peggedAssets/llama-helper/heroku-api.js | 28 - .../llama-helper/historicalApi.js | 26 - .../hodltree/calculateBalances.js | 54 - .../llama-helper/hodltree/calculateEM.js | 42 - .../hodltree/calculateFlashloan.js | 43 - .../hodltree/calculateLendBorrow.js | 45 - .../llama-helper/hodltree/index.js | 0 .../peggedAssets/llama-helper/koyo.js | 98 -- .../peggedAssets/llama-helper/liquity.js | 36 - .../peggedAssets/llama-helper/masterchef.js | 336 ---- .../llama-helper/methodologies.js | 3 - .../peggedAssets/llama-helper/near.js | 137 -- .../peggedAssets/llama-helper/obyte.js | 250 --- src/adapters/peggedAssets/llama-helper/ohm.js | 33 - .../peggedAssets/llama-helper/pact.js | 27 - .../peggedAssets/llama-helper/pool2.js | 156 -- .../peggedAssets/llama-helper/portedTokens.js | 1230 --------------- .../peggedAssets/llama-helper/processPairs.js | 109 -- .../peggedAssets/llama-helper/proton.js | 131 -- .../peggedAssets/llama-helper/requery.js | 22 - .../llama-helper/resolveCrvTokens.js | 202 --- .../peggedAssets/llama-helper/retry.js | 9 - .../peggedAssets/llama-helper/solana.js | 41 - .../peggedAssets/llama-helper/staking.js | 93 -- src/adapters/peggedAssets/llama-helper/sui.js | 23 - .../llama-helper/sunny-pools.json | 1136 ------------- .../peggedAssets/llama-helper/terra.js | 147 -- .../peggedAssets/llama-helper/tezos.js | 133 -- .../peggedAssets/llama-helper/tokenholders.js | 58 - .../peggedAssets/llama-helper/tomb.js | 93 -- .../peggedAssets/llama-helper/unicrypt.js | 281 ---- .../peggedAssets/llama-helper/unifarm.js | 109 -- .../llama-helper/unknownTokens.js | 395 ----- .../peggedAssets/llama-helper/unwrapLPs.js | 946 ----------- .../peggedAssets/llama-helper/utils.js | 180 --- .../peggedAssets/llama-helper/utils/enigma.js | 118 -- .../peggedAssets/llama-helper/utils/pact.js | 123 -- .../peggedAssets/llama-helper/wavesAdapter.js | 24 - .../llama-helper/whitelistedExportKeys.json | 19 - .../peggedAssets/llama-helper/zilliqa.js | 278 ---- src/adapters/peggedAssets/mimatic/index.ts | 7 +- src/adapters/peggedAssets/nostra-uno/index.ts | 2 +- .../peggedAssets/ratio-stable-coin/index.ts | 2 +- src/adapters/peggedAssets/stbl/index.ts | 6 +- src/adapters/peggedAssets/test.ts | 9 +- src/adapters/peggedAssets/tether/index.ts | 2 +- src/adapters/peggedAssets/true-usd/index.ts | 2 +- src/adapters/peggedAssets/usd-coin/index.ts | 4 +- src/adapters/peggedAssets/usn/index.ts | 2 +- 132 files changed, 665 insertions(+), 17711 deletions(-) rename src/adapters/peggedAssets/{llama-helper => helper}/algorand.js (100%) rename src/adapters/peggedAssets/{llama-helper => helper}/algorandUtils/address.js (100%) rename src/adapters/peggedAssets/{llama-helper => helper}/http.js (87%) create mode 100644 src/adapters/peggedAssets/helper/near.js rename src/adapters/peggedAssets/{llama-helper => helper}/starknet.js (100%) delete mode 100644 src/adapters/peggedAssets/helper/terra.js delete mode 100644 src/adapters/peggedAssets/llama-helper/CosmWasm.js delete mode 100644 src/adapters/peggedAssets/llama-helper/aave.js delete mode 100644 src/adapters/peggedAssets/llama-helper/abis/aave.json delete mode 100644 src/adapters/peggedAssets/llama-helper/abis/balancer.json delete mode 100644 src/adapters/peggedAssets/llama-helper/abis/blindex.json delete mode 100644 src/adapters/peggedAssets/llama-helper/abis/brahmafi-aastra.json delete mode 100644 src/adapters/peggedAssets/llama-helper/abis/compound.json delete mode 100644 src/adapters/peggedAssets/llama-helper/abis/cream.json delete mode 100644 src/adapters/peggedAssets/llama-helper/abis/dodo.json delete mode 100644 src/adapters/peggedAssets/llama-helper/abis/erc20.json delete mode 100644 src/adapters/peggedAssets/llama-helper/abis/factory.json delete mode 100644 src/adapters/peggedAssets/llama-helper/abis/getEntireSystemColl.abi.json delete mode 100644 src/adapters/peggedAssets/llama-helper/abis/getPair.json delete mode 100644 src/adapters/peggedAssets/llama-helper/abis/getPricePerShare.json delete mode 100644 src/adapters/peggedAssets/llama-helper/abis/getReserves.json delete mode 100644 src/adapters/peggedAssets/llama-helper/abis/kashipair.json delete mode 100644 src/adapters/peggedAssets/llama-helper/abis/masterchef.json delete mode 100644 src/adapters/peggedAssets/llama-helper/abis/symbol.json delete mode 100644 src/adapters/peggedAssets/llama-helper/abis/token.json delete mode 100644 src/adapters/peggedAssets/llama-helper/abis/token0.json delete mode 100644 src/adapters/peggedAssets/llama-helper/abis/token1.json delete mode 100644 src/adapters/peggedAssets/llama-helper/abis/userInfo.json delete mode 100644 src/adapters/peggedAssets/llama-helper/alchemixHelper.js delete mode 100644 src/adapters/peggedAssets/llama-helper/ankr/abis/AethToken.json delete mode 100644 src/adapters/peggedAssets/llama-helper/ankr/abis/ERC20.json delete mode 100644 src/adapters/peggedAssets/llama-helper/ankr/abis/OnsToken.json delete mode 100644 src/adapters/peggedAssets/llama-helper/ankr/abis/OnxPool.json delete mode 100644 src/adapters/peggedAssets/llama-helper/ankr/abis/OnxToken.json delete mode 100644 src/adapters/peggedAssets/llama-helper/ankr/abis/QuickswapPool.json delete mode 100644 src/adapters/peggedAssets/llama-helper/ankr/abis/QuickswapVault.json delete mode 100644 src/adapters/peggedAssets/llama-helper/ankr/abis/SOnxToken.json delete mode 100644 src/adapters/peggedAssets/llama-helper/ankr/abis/SpookyswapPool.json delete mode 100644 src/adapters/peggedAssets/llama-helper/ankr/abis/SpookyswapVault.json delete mode 100644 src/adapters/peggedAssets/llama-helper/ankr/abis/SushiswapPool.json delete mode 100644 src/adapters/peggedAssets/llama-helper/ankr/abis/SushiswapVault.json delete mode 100644 src/adapters/peggedAssets/llama-helper/ankr/abis/TraderJoePool.json delete mode 100644 src/adapters/peggedAssets/llama-helper/ankr/abis/TraderJoeVault.json delete mode 100644 src/adapters/peggedAssets/llama-helper/ankr/abis/UniswapV2Pair.json delete mode 100644 src/adapters/peggedAssets/llama-helper/ankr/abis/activePool.json delete mode 100644 src/adapters/peggedAssets/llama-helper/ankr/abis/wethAddress.json delete mode 100644 src/adapters/peggedAssets/llama-helper/ankr/chainAddresses.js delete mode 100644 src/adapters/peggedAssets/llama-helper/ankr/networks.js delete mode 100644 src/adapters/peggedAssets/llama-helper/ankr/prices/binance.js delete mode 100644 src/adapters/peggedAssets/llama-helper/ankr/utils.js delete mode 100644 src/adapters/peggedAssets/llama-helper/aptos.js delete mode 100644 src/adapters/peggedAssets/llama-helper/arth.js delete mode 100644 src/adapters/peggedAssets/llama-helper/balancer.js delete mode 100644 src/adapters/peggedAssets/llama-helper/balances.js delete mode 100644 src/adapters/peggedAssets/llama-helper/brahmafi-aastra.js delete mode 100644 src/adapters/peggedAssets/llama-helper/calculateUniTvl.js delete mode 100644 src/adapters/peggedAssets/llama-helper/chains.json delete mode 100644 src/adapters/peggedAssets/llama-helper/compound.js delete mode 100644 src/adapters/peggedAssets/llama-helper/curvePools.js delete mode 100644 src/adapters/peggedAssets/llama-helper/eos.js delete mode 100644 src/adapters/peggedAssets/llama-helper/exports.js delete mode 100644 src/adapters/peggedAssets/llama-helper/formatAddressChecksum.js delete mode 100644 src/adapters/peggedAssets/llama-helper/getBlock.js delete mode 100644 src/adapters/peggedAssets/llama-helper/getChainList.js delete mode 100644 src/adapters/peggedAssets/llama-helper/getEfficientUsdUniTvl.js delete mode 100644 src/adapters/peggedAssets/llama-helper/getTokens.js delete mode 100644 src/adapters/peggedAssets/llama-helper/getUniFactory.js delete mode 100644 src/adapters/peggedAssets/llama-helper/getUniSubgraphTvl.js delete mode 100644 src/adapters/peggedAssets/llama-helper/getUsdUniTvl.js delete mode 100644 src/adapters/peggedAssets/llama-helper/graph.js delete mode 100644 src/adapters/peggedAssets/llama-helper/hbar.js delete mode 100644 src/adapters/peggedAssets/llama-helper/heroku-api.js delete mode 100644 src/adapters/peggedAssets/llama-helper/historicalApi.js delete mode 100644 src/adapters/peggedAssets/llama-helper/hodltree/calculateBalances.js delete mode 100644 src/adapters/peggedAssets/llama-helper/hodltree/calculateEM.js delete mode 100644 src/adapters/peggedAssets/llama-helper/hodltree/calculateFlashloan.js delete mode 100644 src/adapters/peggedAssets/llama-helper/hodltree/calculateLendBorrow.js delete mode 100644 src/adapters/peggedAssets/llama-helper/hodltree/index.js delete mode 100644 src/adapters/peggedAssets/llama-helper/koyo.js delete mode 100644 src/adapters/peggedAssets/llama-helper/liquity.js delete mode 100644 src/adapters/peggedAssets/llama-helper/masterchef.js delete mode 100644 src/adapters/peggedAssets/llama-helper/methodologies.js delete mode 100644 src/adapters/peggedAssets/llama-helper/near.js delete mode 100644 src/adapters/peggedAssets/llama-helper/obyte.js delete mode 100644 src/adapters/peggedAssets/llama-helper/ohm.js delete mode 100644 src/adapters/peggedAssets/llama-helper/pact.js delete mode 100644 src/adapters/peggedAssets/llama-helper/pool2.js delete mode 100644 src/adapters/peggedAssets/llama-helper/portedTokens.js delete mode 100644 src/adapters/peggedAssets/llama-helper/processPairs.js delete mode 100644 src/adapters/peggedAssets/llama-helper/proton.js delete mode 100644 src/adapters/peggedAssets/llama-helper/requery.js delete mode 100644 src/adapters/peggedAssets/llama-helper/resolveCrvTokens.js delete mode 100644 src/adapters/peggedAssets/llama-helper/retry.js delete mode 100644 src/adapters/peggedAssets/llama-helper/solana.js delete mode 100644 src/adapters/peggedAssets/llama-helper/staking.js delete mode 100644 src/adapters/peggedAssets/llama-helper/sui.js delete mode 100644 src/adapters/peggedAssets/llama-helper/sunny-pools.json delete mode 100644 src/adapters/peggedAssets/llama-helper/terra.js delete mode 100644 src/adapters/peggedAssets/llama-helper/tezos.js delete mode 100644 src/adapters/peggedAssets/llama-helper/tokenholders.js delete mode 100644 src/adapters/peggedAssets/llama-helper/tomb.js delete mode 100644 src/adapters/peggedAssets/llama-helper/unicrypt.js delete mode 100644 src/adapters/peggedAssets/llama-helper/unifarm.js delete mode 100644 src/adapters/peggedAssets/llama-helper/unknownTokens.js delete mode 100644 src/adapters/peggedAssets/llama-helper/unwrapLPs.js delete mode 100644 src/adapters/peggedAssets/llama-helper/utils.js delete mode 100644 src/adapters/peggedAssets/llama-helper/utils/enigma.js delete mode 100644 src/adapters/peggedAssets/llama-helper/utils/pact.js delete mode 100644 src/adapters/peggedAssets/llama-helper/wavesAdapter.js delete mode 100644 src/adapters/peggedAssets/llama-helper/whitelistedExportKeys.json delete mode 100644 src/adapters/peggedAssets/llama-helper/zilliqa.js diff --git a/package-lock.json b/package-lock.json index 5fd2e7b9..f3c8d139 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2883,9 +2883,9 @@ } }, "node_modules/@defillama/sdk": { - "version": "5.0.60", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-5.0.60.tgz", - "integrity": "sha512-B7upEgd1Fad1duY0cRuPpcaLpTasIHjgqmQ73cJr189XmgEbsTUxQqPfD5mbsjdDgJMDSE5YjEPzjDIkLXBqfg==", + "version": "5.0.74", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-5.0.74.tgz", + "integrity": "sha512-qk/UrP5A55Co7pnj7WE3Cloc7zZSFESUTb5fXRaowH9K5oWi/JRJ4LQZOI38sami586q9/sWLwJrKBlU+lQIVw==", "dependencies": { "@aws-sdk/client-s3": "^3.400.0", "@elastic/elasticsearch": "^8.13.1", @@ -2939,9 +2939,9 @@ } }, "node_modules/@defillama/sdk/node_modules/ethers": { - "version": "6.12.1", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.12.1.tgz", - "integrity": "sha512-j6wcVoZf06nqEcBbDWkKg8Fp895SS96dSnTCjiXT+8vt2o02raTn4Lo9ERUuIVU5bAjoPYeA+7ytQFexFmLuVw==", + "version": "6.13.1", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.13.1.tgz", + "integrity": "sha512-hdJ2HOxg/xx97Lm9HdCWk949BfYqYWpyw4//78SiwOLgASyfrNszfMUNB2joKjvGUdwhHfaiMMFFwacVVoLR9A==", "funding": [ { "type": "individual", @@ -2959,7 +2959,7 @@ "@types/node": "18.15.13", "aes-js": "4.0.0-beta.5", "tslib": "2.4.0", - "ws": "8.5.0" + "ws": "8.17.1" }, "engines": { "node": ">=14.0.0" @@ -2971,15 +2971,15 @@ "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" }, "node_modules/@defillama/sdk/node_modules/ws": { - "version": "8.5.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.5.0.tgz", - "integrity": "sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==", + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz", + "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==", "engines": { "node": ">=10.0.0" }, "peerDependencies": { "bufferutil": "^4.0.1", - "utf-8-validate": "^5.0.2" + "utf-8-validate": ">=5.0.2" }, "peerDependenciesMeta": { "bufferutil": { @@ -4929,9 +4929,9 @@ } }, "node_modules/@pm2/agent": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/@pm2/agent/-/agent-2.0.3.tgz", - "integrity": "sha512-xkqqCoTf5VsciMqN0vb9jthW7olVAi4KRFNddCc7ZkeJZ3i8QwZANr4NSH2H5DvseRFHq7MiPspRY/EWAFWWTg==", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@pm2/agent/-/agent-2.0.4.tgz", + "integrity": "sha512-n7WYvvTJhHLS2oBb1PjOtgLpMhgImOq8sXkPBw6smeg9LJBWZjiEgPKOpR8mn9UJZsB5P3W4V/MyvNnp31LKeA==", "dependencies": { "async": "~3.2.0", "chalk": "~3.0.0", @@ -4945,7 +4945,7 @@ "pm2-axon-rpc": "~0.7.0", "proxy-agent": "~6.3.0", "semver": "~7.5.0", - "ws": "~7.4.0" + "ws": "~7.5.10" } }, "node_modules/@pm2/agent/node_modules/ansi-styles": { @@ -5044,6 +5044,26 @@ "node": ">=8" } }, + "node_modules/@pm2/agent/node_modules/ws": { + "version": "7.5.10", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", + "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==", + "engines": { + "node": ">=8.3.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, "node_modules/@pm2/agent/node_modules/yallist": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", @@ -6073,9 +6093,9 @@ } }, "node_modules/@serverless/platform-client/node_modules/ws": { - "version": "7.5.9", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", - "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", + "version": "7.5.10", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", + "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==", "dev": true, "engines": { "node": ">=8.3.0" @@ -9370,11 +9390,11 @@ } }, "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", "dependencies": { - "fill-range": "^7.0.1" + "fill-range": "^7.1.1" }, "engines": { "node": ">=8" @@ -12081,9 +12101,9 @@ } }, "node_modules/engine.io-client": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-3.5.3.tgz", - "integrity": "sha512-qsgyc/CEhJ6cgMUwxRRtOndGVhIu5hpL5tR4umSpmX/MvkFoIxUTM7oFMDQumHNzlNLwSVy6qhstFPoWTf7dOw==", + "version": "3.5.4", + "resolved": "https://registry.npmjs.org/engine.io-client/-/engine.io-client-3.5.4.tgz", + "integrity": "sha512-ydc8uuMMDxC5KCKNJN3zZKYJk2sgyTuTZQ7Aj1DJSsLKAcizA/PzWivw8fZMIjJVBo2CJOYzntv4FSjY/Lr//g==", "dev": true, "dependencies": { "component-emitter": "~1.3.0", @@ -12094,7 +12114,7 @@ "indexof": "0.0.1", "parseqs": "0.0.6", "parseuri": "0.0.6", - "ws": "~7.4.2", + "ws": "~7.5.10", "xmlhttprequest-ssl": "~1.6.2", "yeast": "0.1.2" } @@ -12114,6 +12134,27 @@ "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==", "dev": true }, + "node_modules/engine.io-client/node_modules/ws": { + "version": "7.5.10", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", + "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==", + "dev": true, + "engines": { + "node": ">=8.3.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, "node_modules/engine.io-parser": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/engine.io-parser/-/engine.io-parser-2.2.1.tgz", @@ -13515,9 +13556,9 @@ } }, "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", "dependencies": { "to-regex-range": "^5.0.1" }, @@ -21939,9 +21980,9 @@ } }, "node_modules/rpc-websockets/node_modules/ws": { - "version": "8.17.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.0.tgz", - "integrity": "sha512-uJq6108EgZMAl20KagGkzCKfMEjxmKvZHG7Tlq0Z6nOky7YF7aq4mOx6xK8TJ/i1LeK4Qus7INktacctDgY8Ow==", + "version": "8.18.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz", + "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==", "engines": { "node": ">=10.0.0" }, diff --git a/src/adapters/package-lock.json b/src/adapters/package-lock.json index 9166cfce..72655acb 100644 --- a/src/adapters/package-lock.json +++ b/src/adapters/package-lock.json @@ -896,11 +896,12 @@ } }, "node_modules/@defillama/sdk": { - "version": "5.0.55", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-5.0.55.tgz", - "integrity": "sha512-IYY14D7wSR/lHP3adExvBahynnpcbYubHQKKzmirNq1LVSGaLMtYdPKaf9cwlvZk0hejNwTjP1HF0yF0CehIDA==", + "version": "5.0.74", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-5.0.74.tgz", + "integrity": "sha512-qk/UrP5A55Co7pnj7WE3Cloc7zZSFESUTb5fXRaowH9K5oWi/JRJ4LQZOI38sami586q9/sWLwJrKBlU+lQIVw==", "dependencies": { "@aws-sdk/client-s3": "^3.400.0", + "@elastic/elasticsearch": "^8.13.1", "@supercharge/promise-pool": "^2.1.0", "axios": "^1.6.5", "ethers": "^6.0.0", @@ -908,49 +909,6 @@ "tron-format-address": "^0.1.11" } }, - "node_modules/@defillama/sdk/node_modules/@noble/hashes": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz", - "integrity": "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==", - "engines": { - "node": ">= 16" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/@defillama/sdk/node_modules/aes-js": { - "version": "4.0.0-beta.5", - "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-4.0.0-beta.5.tgz", - "integrity": "sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q==" - }, - "node_modules/@defillama/sdk/node_modules/ethers": { - "version": "6.12.0", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.12.0.tgz", - "integrity": "sha512-zL5NlOTjML239gIvtVJuaSk0N9GQLi1Hom3ZWUszE5lDTQE/IVB62mrPkQ2W1bGcZwVGSLaetQbWNQSvI4rGDQ==", - "funding": [ - { - "type": "individual", - "url": "https://github.com/sponsors/ethers-io/" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@adraffy/ens-normalize": "1.10.1", - "@noble/curves": "1.2.0", - "@noble/hashes": "1.3.2", - "@types/node": "18.15.13", - "aes-js": "4.0.0-beta.5", - "tslib": "2.4.0", - "ws": "8.5.0" - }, - "engines": { - "node": ">=14.0.0" - } - }, "node_modules/@defillama/sdk/node_modules/p-limit": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", @@ -965,31 +923,50 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@defillama/sdk/node_modules/tslib": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", - "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" - }, - "node_modules/@defillama/sdk/node_modules/ws": { - "version": "8.5.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.5.0.tgz", - "integrity": "sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==", - "engines": { - "node": ">=10.0.0" + "node_modules/@elastic/elasticsearch": { + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/@elastic/elasticsearch/-/elasticsearch-8.14.0.tgz", + "integrity": "sha512-MGrgCI4y+Ozssf5Q2IkVJlqt5bUMnKIICG2qxeOfrJNrVugMCBCAQypyesmSSocAtNm8IX3LxfJ3jQlFHmKe2w==", + "dependencies": { + "@elastic/transport": "^8.6.0", + "tslib": "^2.4.0" }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": "^5.0.2" + "engines": { + "node": ">=18" + } + }, + "node_modules/@elastic/elasticsearch/node_modules/tslib": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.3.tgz", + "integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==" + }, + "node_modules/@elastic/transport": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/@elastic/transport/-/transport-8.7.0.tgz", + "integrity": "sha512-IqXT7a8DZPJtqP2qmX1I2QKmxYyN27kvSW4g6pInESE1SuGwZDp2FxHJ6W2kwmYOJwQdAt+2aWwzXO5jHo9l4A==", + "dependencies": { + "@opentelemetry/api": "1.x", + "debug": "^4.3.4", + "hpagent": "^1.0.0", + "ms": "^2.1.3", + "secure-json-parse": "^2.4.0", + "tslib": "^2.4.0", + "undici": "^6.12.0" }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } + "engines": { + "node": ">=18" } }, + "node_modules/@elastic/transport/node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" + }, + "node_modules/@elastic/transport/node_modules/tslib": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.3.tgz", + "integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==" + }, "node_modules/@ethersproject/bytes": { "version": "5.6.1", "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.6.1.tgz", @@ -1056,6 +1033,14 @@ "url": "https://paulmillr.com/funding/" } }, + "node_modules/@opentelemetry/api": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.9.0.tgz", + "integrity": "sha512-3giAOQvZiH5F9bMlMiv8+GSPMeqg0dbaeo58/0SlA9sxSqZhnUtxzX9/2FzyhS9sWQf5S0GJE0AKBrFqjpeYcg==", + "engines": { + "node": ">=8.0.0" + } + }, "node_modules/@project-serum/anchor": { "version": "0.18.2", "resolved": "https://registry.npmjs.org/@project-serum/anchor/-/anchor-0.18.2.tgz", @@ -2118,6 +2103,11 @@ "node": ">=0.4.0" } }, + "node_modules/aes-js": { + "version": "4.0.0-beta.5", + "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-4.0.0-beta.5.tgz", + "integrity": "sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q==" + }, "node_modules/agentkeepalive": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.5.0.tgz", @@ -2876,6 +2866,22 @@ "resolved": "https://registry.npmjs.org/dash-ast/-/dash-ast-1.0.0.tgz", "integrity": "sha512-Vy4dx7gquTeMcQR/hDkYLGUnwVil6vk4FOOct+djUnHOUWt+zJPJAaRIXaAFkPXtJjvlY7o3rfRu0/3hpnwoUA==" }, + "node_modules/debug": { + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.5.tgz", + "integrity": "sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==", + "dependencies": { + "ms": "2.1.2" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, "node_modules/defined": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/defined/-/defined-1.0.0.tgz", @@ -3075,6 +3081,69 @@ "es6-promise": "^4.0.3" } }, + "node_modules/ethers": { + "version": "6.13.1", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.13.1.tgz", + "integrity": "sha512-hdJ2HOxg/xx97Lm9HdCWk949BfYqYWpyw4//78SiwOLgASyfrNszfMUNB2joKjvGUdwhHfaiMMFFwacVVoLR9A==", + "funding": [ + { + "type": "individual", + "url": "https://github.com/sponsors/ethers-io/" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@adraffy/ens-normalize": "1.10.1", + "@noble/curves": "1.2.0", + "@noble/hashes": "1.3.2", + "@types/node": "18.15.13", + "aes-js": "4.0.0-beta.5", + "tslib": "2.4.0", + "ws": "8.17.1" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/ethers/node_modules/@noble/hashes": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz", + "integrity": "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/ethers/node_modules/tslib": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", + "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" + }, + "node_modules/ethers/node_modules/ws": { + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz", + "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, "node_modules/eventemitter3": { "version": "4.0.7", "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", @@ -3290,6 +3359,14 @@ "minimalistic-crypto-utils": "^1.0.1" } }, + "node_modules/hpagent": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/hpagent/-/hpagent-1.2.0.tgz", + "integrity": "sha512-A91dYTeIB6NoXG+PxTQpCCDDnfHsW9kc06Lvpu1TEe9gnd6ZFeiBoRO9JvzEv6xK7EX97/dUE8g/vBMTqTS3CA==", + "engines": { + "node": ">=14" + } + }, "node_modules/htmlescape": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/htmlescape/-/htmlescape-1.1.1.tgz", @@ -4002,9 +4079,9 @@ } }, "node_modules/rpc-websockets/node_modules/ws": { - "version": "8.16.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.16.0.tgz", - "integrity": "sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==", + "version": "8.18.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz", + "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==", "engines": { "node": ">=10.0.0" }, @@ -4047,6 +4124,11 @@ "optional": true, "peer": true }, + "node_modules/secure-json-parse": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/secure-json-parse/-/secure-json-parse-2.7.0.tgz", + "integrity": "sha512-6aU+Rwsezw7VR8/nyvKTx8QpWH9FrcYiXXlqC4z5d5XQBDRqtbfsRjnwGyqbi3gddNtWHuEk9OANUotL26qKUw==" + }, "node_modules/sha.js": { "version": "2.4.11", "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", @@ -4413,6 +4495,14 @@ "undeclared-identifiers": "bin.js" } }, + "node_modules/undici": { + "version": "6.19.2", + "resolved": "https://registry.npmjs.org/undici/-/undici-6.19.2.tgz", + "integrity": "sha512-JfjKqIauur3Q6biAtHJ564e3bWa8VvT+7cSiOJHFbX4Erv6CLGDpg8z+Fmg/1OI/47RA+GI2QZaF48SSaLvyBA==", + "engines": { + "node": ">=18.17" + } + }, "node_modules/url": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz", @@ -4488,9 +4578,9 @@ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, "node_modules/ws": { - "version": "7.5.9", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", - "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", + "version": "7.5.10", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", + "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==", "engines": { "node": ">=8.3.0" }, @@ -5363,11 +5453,12 @@ } }, "@defillama/sdk": { - "version": "5.0.55", - "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-5.0.55.tgz", - "integrity": "sha512-IYY14D7wSR/lHP3adExvBahynnpcbYubHQKKzmirNq1LVSGaLMtYdPKaf9cwlvZk0hejNwTjP1HF0yF0CehIDA==", + "version": "5.0.74", + "resolved": "https://registry.npmjs.org/@defillama/sdk/-/sdk-5.0.74.tgz", + "integrity": "sha512-qk/UrP5A55Co7pnj7WE3Cloc7zZSFESUTb5fXRaowH9K5oWi/JRJ4LQZOI38sami586q9/sWLwJrKBlU+lQIVw==", "requires": { "@aws-sdk/client-s3": "^3.400.0", + "@elastic/elasticsearch": "^8.13.1", "@supercharge/promise-pool": "^2.1.0", "axios": "^1.6.5", "ethers": "^6.0.0", @@ -5375,30 +5466,6 @@ "tron-format-address": "^0.1.11" }, "dependencies": { - "@noble/hashes": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz", - "integrity": "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==" - }, - "aes-js": { - "version": "4.0.0-beta.5", - "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-4.0.0-beta.5.tgz", - "integrity": "sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q==" - }, - "ethers": { - "version": "6.12.0", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.12.0.tgz", - "integrity": "sha512-zL5NlOTjML239gIvtVJuaSk0N9GQLi1Hom3ZWUszE5lDTQE/IVB62mrPkQ2W1bGcZwVGSLaetQbWNQSvI4rGDQ==", - "requires": { - "@adraffy/ens-normalize": "1.10.1", - "@noble/curves": "1.2.0", - "@noble/hashes": "1.3.2", - "@types/node": "18.15.13", - "aes-js": "4.0.0-beta.5", - "tslib": "2.4.0", - "ws": "8.5.0" - } - }, "p-limit": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", @@ -5406,17 +5473,48 @@ "requires": { "yocto-queue": "^0.1.0" } - }, + } + } + }, + "@elastic/elasticsearch": { + "version": "8.14.0", + "resolved": "https://registry.npmjs.org/@elastic/elasticsearch/-/elasticsearch-8.14.0.tgz", + "integrity": "sha512-MGrgCI4y+Ozssf5Q2IkVJlqt5bUMnKIICG2qxeOfrJNrVugMCBCAQypyesmSSocAtNm8IX3LxfJ3jQlFHmKe2w==", + "requires": { + "@elastic/transport": "^8.6.0", + "tslib": "^2.4.0" + }, + "dependencies": { "tslib": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", - "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.3.tgz", + "integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==" + } + } + }, + "@elastic/transport": { + "version": "8.7.0", + "resolved": "https://registry.npmjs.org/@elastic/transport/-/transport-8.7.0.tgz", + "integrity": "sha512-IqXT7a8DZPJtqP2qmX1I2QKmxYyN27kvSW4g6pInESE1SuGwZDp2FxHJ6W2kwmYOJwQdAt+2aWwzXO5jHo9l4A==", + "requires": { + "@opentelemetry/api": "1.x", + "debug": "^4.3.4", + "hpagent": "^1.0.0", + "ms": "^2.1.3", + "secure-json-parse": "^2.4.0", + "tslib": "^2.4.0", + "undici": "^6.12.0" + }, + "dependencies": { + "ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==" }, - "ws": { - "version": "8.5.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.5.0.tgz", - "integrity": "sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==", - "requires": {} + "tslib": { + "version": "2.6.3", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.6.3.tgz", + "integrity": "sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==" } } }, @@ -5453,6 +5551,11 @@ "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.4.0.tgz", "integrity": "sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==" }, + "@opentelemetry/api": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/api/-/api-1.9.0.tgz", + "integrity": "sha512-3giAOQvZiH5F9bMlMiv8+GSPMeqg0dbaeo58/0SlA9sxSqZhnUtxzX9/2FzyhS9sWQf5S0GJE0AKBrFqjpeYcg==" + }, "@project-serum/anchor": { "version": "0.18.2", "resolved": "https://registry.npmjs.org/@project-serum/anchor/-/anchor-0.18.2.tgz", @@ -6435,6 +6538,11 @@ "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-7.2.0.tgz", "integrity": "sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==" }, + "aes-js": { + "version": "4.0.0-beta.5", + "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-4.0.0-beta.5.tgz", + "integrity": "sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q==" + }, "agentkeepalive": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/agentkeepalive/-/agentkeepalive-4.5.0.tgz", @@ -7130,6 +7238,14 @@ "resolved": "https://registry.npmjs.org/dash-ast/-/dash-ast-1.0.0.tgz", "integrity": "sha512-Vy4dx7gquTeMcQR/hDkYLGUnwVil6vk4FOOct+djUnHOUWt+zJPJAaRIXaAFkPXtJjvlY7o3rfRu0/3hpnwoUA==" }, + "debug": { + "version": "4.3.5", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.5.tgz", + "integrity": "sha512-pt0bNEmneDIvdL1Xsd9oDQ/wrQRkXDT4AUWlNZNPKvW5x/jyO9VFXkJUP07vQ2upmw5PlaITaPKc31jK13V+jg==", + "requires": { + "ms": "2.1.2" + } + }, "defined": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/defined/-/defined-1.0.0.tgz", @@ -7311,6 +7427,38 @@ "es6-promise": "^4.0.3" } }, + "ethers": { + "version": "6.13.1", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.13.1.tgz", + "integrity": "sha512-hdJ2HOxg/xx97Lm9HdCWk949BfYqYWpyw4//78SiwOLgASyfrNszfMUNB2joKjvGUdwhHfaiMMFFwacVVoLR9A==", + "requires": { + "@adraffy/ens-normalize": "1.10.1", + "@noble/curves": "1.2.0", + "@noble/hashes": "1.3.2", + "@types/node": "18.15.13", + "aes-js": "4.0.0-beta.5", + "tslib": "2.4.0", + "ws": "8.17.1" + }, + "dependencies": { + "@noble/hashes": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz", + "integrity": "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==" + }, + "tslib": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", + "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" + }, + "ws": { + "version": "8.17.1", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.17.1.tgz", + "integrity": "sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ==", + "requires": {} + } + } + }, "eventemitter3": { "version": "4.0.7", "resolved": "https://registry.npmjs.org/eventemitter3/-/eventemitter3-4.0.7.tgz", @@ -7466,6 +7614,11 @@ "minimalistic-crypto-utils": "^1.0.1" } }, + "hpagent": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/hpagent/-/hpagent-1.2.0.tgz", + "integrity": "sha512-A91dYTeIB6NoXG+PxTQpCCDDnfHsW9kc06Lvpu1TEe9gnd6ZFeiBoRO9JvzEv6xK7EX97/dUE8g/vBMTqTS3CA==" + }, "htmlescape": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/htmlescape/-/htmlescape-1.1.1.tgz", @@ -8076,9 +8229,9 @@ }, "dependencies": { "ws": { - "version": "8.16.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.16.0.tgz", - "integrity": "sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==", + "version": "8.18.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.0.tgz", + "integrity": "sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==", "requires": {} } } @@ -8095,6 +8248,11 @@ "optional": true, "peer": true }, + "secure-json-parse": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/secure-json-parse/-/secure-json-parse-2.7.0.tgz", + "integrity": "sha512-6aU+Rwsezw7VR8/nyvKTx8QpWH9FrcYiXXlqC4z5d5XQBDRqtbfsRjnwGyqbi3gddNtWHuEk9OANUotL26qKUw==" + }, "sha.js": { "version": "2.4.11", "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", @@ -8427,6 +8585,11 @@ "xtend": "^4.0.1" } }, + "undici": { + "version": "6.19.2", + "resolved": "https://registry.npmjs.org/undici/-/undici-6.19.2.tgz", + "integrity": "sha512-JfjKqIauur3Q6biAtHJ564e3bWa8VvT+7cSiOJHFbX4Erv6CLGDpg8z+Fmg/1OI/47RA+GI2QZaF48SSaLvyBA==" + }, "url": { "version": "0.11.0", "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz", @@ -8497,9 +8660,9 @@ "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=" }, "ws": { - "version": "7.5.9", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.9.tgz", - "integrity": "sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q==", + "version": "7.5.10", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.10.tgz", + "integrity": "sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==", "requires": {} }, "xtend": { diff --git a/src/adapters/peggedAssets/binance-usd/index.ts b/src/adapters/peggedAssets/binance-usd/index.ts index de7eb3e3..13116222 100644 --- a/src/adapters/peggedAssets/binance-usd/index.ts +++ b/src/adapters/peggedAssets/binance-usd/index.ts @@ -8,7 +8,7 @@ import { supplyInEthereumBridge, osmosisSupply, } from "../helper/getSupply"; -import { call as nearCall } from "../llama-helper/near"; +import { call as nearCall } from "../helper/near"; import { getTotalBridged as pnGetTotalBridged } from "../helper/polynetwork"; import { ChainBlocks, diff --git a/src/adapters/peggedAssets/bob/index.ts b/src/adapters/peggedAssets/bob/index.ts index bbfd3904..2c93390c 100644 --- a/src/adapters/peggedAssets/bob/index.ts +++ b/src/adapters/peggedAssets/bob/index.ts @@ -1,36 +1,10 @@ -const sdk = require("@defillama/sdk"); import { sumSingleBalance } from "../helper/generalUtil"; import { - ChainBlocks, PeggedIssuanceAdapter, - Balances, ChainContracts, + Balances, } from "../peggedAsset.type"; -const axios = require("axios"); -const retry = require("async-retry"); -import { returnBalance } from "../llama-helper/utils"; -/* - * Adapter attempts to approximate collateralized BOB supply by getting total value - * of collateral assets in the BOB UniV3 pools on each chain. - * If the pool addresses can be retrieved using Uni V3 Factory somehow, should re-write adapter to do that. - */ +import { ChainApi } from "@defillama/sdk"; -/* - -const chainContracts: ChainContracts = { - polygon: { - issued: ["0xB0B195aEFA3650A6908f15CdaC7D92F8a5791B0B"], - }, - optimism: { - issued: ["0xb0b195aefa3650a6908f15cdac7d92f8a5791b0b"], - }, - ethereum: { - issued: ["0xb0b195aefa3650a6908f15cdac7d92f8a5791b0b"], - }, - bsc: { - issued: ["0xB0B195aEFA3650A6908f15CdaC7D92F8a5791B0B"] - } -}; -*/ const uniPoolsMapping = { ethereum: { @@ -80,36 +54,12 @@ const uniPoolsMapping = { }; async function getChainCollateralUsdValue(chain: string) { - return async function ( - _timestamp: number, - _ethBlock: number, - _chainBlocks: ChainBlocks - ) { + return async function (api: ChainApi) { + const toa = Object.entries(uniPoolsMapping[chain]).map(([pool, token]) => [token, pool]) + await api.sumTokens({ tokensAndOwners: toa}) + const usdValue = await api.getUSDValue() let balances = {} as Balances; - const uniPools = uniPoolsMapping[chain]; - let tokenBalances = {} as { [token: string]: number }; - await Promise.all( - Object.entries(uniPools).map(async ([pool, token]) => { - const balance = await returnBalance( - token, - pool, - _chainBlocks?.[chain], - chain - ); - tokenBalances[`${chain}:${token}`] = - (tokenBalances[`${chain}:${token}`] ?? 0) + balance; - }) - ); - const tokens = Object.keys(tokenBalances); - const prices = ( - await axios.get( - "https://coins.llama.fi/prices/current/" + tokens.join(",") - ) - ).data.coins; - Object.entries(tokenBalances).map(([token, balance]) => { - const usdValue = balance * (prices[token]?.price ?? 0); - sumSingleBalance(balances, "peggedUSD", usdValue, "issued", false); - }); + sumSingleBalance(balances, "peggedUSD", usdValue, "issued", false); return balances; }; } diff --git a/src/adapters/peggedAssets/bucket-protocol-buck-stablecoin/index.ts b/src/adapters/peggedAssets/bucket-protocol-buck-stablecoin/index.ts index 8b1a4ba3..dd837d60 100644 --- a/src/adapters/peggedAssets/bucket-protocol-buck-stablecoin/index.ts +++ b/src/adapters/peggedAssets/bucket-protocol-buck-stablecoin/index.ts @@ -1,10 +1,9 @@ import { sumSingleBalance } from "../helper/generalUtil"; import { - ChainBlocks, Balances, - PeggedIssuanceAdapter, ChainContracts, + PeggedIssuanceAdapter, ChainContracts, } from "../peggedAsset.type"; -import { getObject } from "../helper/sui"; +import * as sui from "../helper/sui"; const chainContracts: ChainContracts = { @@ -13,16 +12,12 @@ const chainContracts: ChainContracts = { "0x9e3dab13212b27f5434416939db5dec6a319d15b89a84fd074d03ece6350d3df", ], }, -}; +} async function suiMinted() { - return async function ( - _timestamp: number, - _ethBlock: number, - _chainBlocks: ChainBlocks - ): Promise { + return async function (): Promise { let balances = {} as Balances; - const { fields: buckAmount } = await getObject( + const { fields: buckAmount } = await sui.getObject( chainContracts.sui.issued[0] ); const mintedAmount = diff --git a/src/adapters/peggedAssets/dai/index.ts b/src/adapters/peggedAssets/dai/index.ts index 39838ab2..b2dd9132 100644 --- a/src/adapters/peggedAssets/dai/index.ts +++ b/src/adapters/peggedAssets/dai/index.ts @@ -15,7 +15,7 @@ import { getBalance as ontologyGetBalance, } from "../helper/ontology"; import { getTotalSupply as kavaGetTotalSupply } from "../helper/kava"; -import { call as nearCall } from "../llama-helper/near"; +import { call as nearCall } from "../helper/near"; import { ChainBlocks, PeggedIssuanceAdapter, @@ -227,7 +227,7 @@ const adapter: PeggedIssuanceAdapter = { solana: { ethereum: solanaMintedOrBridged(chainContracts.solana.bridgedFromETH), polygon: solanaMintedOrBridged(chainContracts.solana.bridgedFromPolygon), - avalanche: solanaMintedOrBridged(chainContracts.solana.bridgedFromAvax), + avax: solanaMintedOrBridged(chainContracts.solana.bridgedFromAvax), fantom: solanaMintedOrBridged(chainContracts.solana.bridgedFromFantom), }, polygon: { diff --git a/src/adapters/peggedAssets/frax/index.ts b/src/adapters/peggedAssets/frax/index.ts index 600b3f2a..34896c6f 100644 --- a/src/adapters/peggedAssets/frax/index.ts +++ b/src/adapters/peggedAssets/frax/index.ts @@ -12,7 +12,7 @@ import { PeggedIssuanceAdapter, Balances, ChainContracts, } from "../peggedAsset.type"; -import { call as nearCall } from "../llama-helper/near"; +import { call as nearCall } from "../helper/near"; // all multichain diff --git a/src/adapters/peggedAssets/llama-helper/algorand.js b/src/adapters/peggedAssets/helper/algorand.js similarity index 100% rename from src/adapters/peggedAssets/llama-helper/algorand.js rename to src/adapters/peggedAssets/helper/algorand.js diff --git a/src/adapters/peggedAssets/llama-helper/algorandUtils/address.js b/src/adapters/peggedAssets/helper/algorandUtils/address.js similarity index 100% rename from src/adapters/peggedAssets/llama-helper/algorandUtils/address.js rename to src/adapters/peggedAssets/helper/algorandUtils/address.js diff --git a/src/adapters/peggedAssets/helper/aptos.ts b/src/adapters/peggedAssets/helper/aptos.ts index ba1fc1eb..6e1bff2b 100644 --- a/src/adapters/peggedAssets/helper/aptos.ts +++ b/src/adapters/peggedAssets/helper/aptos.ts @@ -27,3 +27,10 @@ export async function getTotalSupply(account: string, type?: string) { const supply = resources?.data?.supply?.vec?.[0].integer?.vec?.[0].value; return supply / 10 ** decimals; } + +export async function getTokenSupply(token: string) { + const { data } = await axios.get(`${endpoint}/v1/accounts/${token}/resources`); + const coinInfo = data.find((coin: any) => coin.type.startsWith('0x1::coin::CoinInfo')); + + return coinInfo.data.supply.vec[0].integer.vec[0].value / 10 ** coinInfo.data.decimals; +} \ No newline at end of file diff --git a/src/adapters/peggedAssets/helper/getSupply.ts b/src/adapters/peggedAssets/helper/getSupply.ts index 22f1e892..07bac6a1 100644 --- a/src/adapters/peggedAssets/helper/getSupply.ts +++ b/src/adapters/peggedAssets/helper/getSupply.ts @@ -5,13 +5,13 @@ import type { PeggedIssuanceAdapter, } from "../peggedAsset.type"; import { sumSingleBalance } from "./generalUtil"; -import { getTokenSupply as solanaGetTokenSupply } from "../llama-helper/solana"; -import { totalSupply as terraGetTotalSupply } from "../llama-helper/terra"; // NOTE this is NOT currently exported +import { getTokenSupply as solanaGetTokenSupply } from "../helper/solana"; import { ChainApi } from "@defillama/sdk"; -import * as sui from "../llama-helper/sui"; -import * as aptos from "../llama-helper/aptos"; +import * as sui from "../helper/sui"; +import * as aptos from "../helper/aptos"; const axios = require("axios"); const retry = require("async-retry"); +process.env.TAIKO_RPC = 'https://rpc.taiko.xyz' type BridgeAndReserveAddressPair = [string, string[]]; @@ -42,7 +42,6 @@ export function bridgedSupply( ? sumSingleBalance(balances, assetPegType, supplies[i] / 10 ** decimals, bridgeName, false, bridgedFromChain) : sumSingleBalance(balances, assetPegType, supplies[i] / 10 ** decimals, addresses[i], true); } - return balances; }; } @@ -108,26 +107,13 @@ export function solanaMintedOrBridged( }; } -export function terraSupply(addresses: string[], decimals: number) { +export function terraSupply(_addresses: string[], _decimals: number) { return async function ( _timestamp: number, _ethBlock: number, _chainBlocks: ChainBlocks ) { let balances = {} as Balances; - for (let address of addresses) { - const totalSupply = await terraGetTotalSupply( - address, - _chainBlocks?.["terra"] - ); - sumSingleBalance( - balances, - "peggedUSD", - totalSupply / 10 ** decimals, - address, - true - ); - } return balances; }; } diff --git a/src/adapters/peggedAssets/llama-helper/http.js b/src/adapters/peggedAssets/helper/http.js similarity index 87% rename from src/adapters/peggedAssets/llama-helper/http.js rename to src/adapters/peggedAssets/helper/http.js index c8edd733..3bc69478 100644 --- a/src/adapters/peggedAssets/llama-helper/http.js +++ b/src/adapters/peggedAssets/helper/http.js @@ -1,4 +1,11 @@ -const retry = require('./retry') +const retryModule = require('async-retry') + +async function retry(func){ + return retryModule(func, { + retries:3 + }) +} + const axios = require("axios") const { request } = require("graphql-request") const COVALENT_KEY = 'ckey_72cd3b74b4a048c9bc671f7c5a6' diff --git a/src/adapters/peggedAssets/helper/near.js b/src/adapters/peggedAssets/helper/near.js new file mode 100644 index 00000000..dc3583ee --- /dev/null +++ b/src/adapters/peggedAssets/helper/near.js @@ -0,0 +1,25 @@ +const axios = require("axios") +const endpoint = "https://rpc.mainnet.near.org"; + +async function call(contract, method, args = {}) { + const result = await axios.post(endpoint, { + jsonrpc: "2.0", + id: "1", + method: "query", + params: { + request_type: "call_function", + finality: "final", + account_id: contract, + method_name: method, + args_base64: Buffer.from(JSON.stringify(args)).toString("base64"), + }, + }); + if (result.data.error) { + throw new Error(`${result.data.error.message}: ${result.data.error.data}`); + } + return JSON.parse(Buffer.from(result.data.result.result).toString()); +} + +module.exports = { + call, +}; diff --git a/src/adapters/peggedAssets/helper/solana.js b/src/adapters/peggedAssets/helper/solana.js index e4005812..a655d1ce 100644 --- a/src/adapters/peggedAssets/helper/solana.js +++ b/src/adapters/peggedAssets/helper/solana.js @@ -1,3 +1,41 @@ -const solana = require("../llama-helper/solana"); +const axios = require("axios"); -module.exports = solana; +const endpoint = process.env.SOLANA_RPC ?? "https://api.mainnet-beta.solana.com"; + +async function getTokenSupply(token) { + const tokenSupply = await axios.post(endpoint, { + jsonrpc: "2.0", + id: 1, + method: "getTokenSupply", + params: [token], + }); + return tokenSupply.data.result.value.uiAmount; +} + +async function getTokenBalance(token, account) { + const tokenBalance = await axios.post(endpoint, { + jsonrpc: "2.0", + id: 1, + method: "getTokenAccountsByOwner", + params: [ + account, + { + mint: token, + }, + { + encoding: "jsonParsed", + }, + ], + }); + return tokenBalance.data.result.value.reduce( + (total, account) => + total + account.account.data.parsed.info.tokenAmount.uiAmount, + 0 + ); +} + +module.exports = { + getTokenSupply, + getTokenBalance, + endpoint +}; diff --git a/src/adapters/peggedAssets/llama-helper/starknet.js b/src/adapters/peggedAssets/helper/starknet.js similarity index 100% rename from src/adapters/peggedAssets/llama-helper/starknet.js rename to src/adapters/peggedAssets/helper/starknet.js diff --git a/src/adapters/peggedAssets/helper/sui.ts b/src/adapters/peggedAssets/helper/sui.ts index 04525880..2a05c7fa 100644 --- a/src/adapters/peggedAssets/helper/sui.ts +++ b/src/adapters/peggedAssets/helper/sui.ts @@ -1,13 +1,13 @@ -import http from "../llama-helper/http"; -//import { getEnv } from '../helper/env'; +import http from "../helper/http"; +const axios = require("axios"); interface CallOptions { withMetadata?: boolean; } -const endpoint = (): string => "https://fullnode.mainnet.sui.io/"; +export const endpoint = (): string => "https://fullnode.mainnet.sui.io/"; -async function getObject(objectId: string): Promise { +export async function getObject(objectId: string): Promise { return ( await call("sui_getObject", [ objectId, @@ -20,7 +20,7 @@ async function getObject(objectId: string): Promise { ).content; } -async function call( +export async function call( method: string, params: any, { withMetadata = false }: CallOptions = {} @@ -35,4 +35,19 @@ async function call( return withMetadata ? result : result.data; } -export { endpoint, call, getObject }; + +export async function getTokenSupply(token: string) { + const { data: { result: { decimals } } } = await axios.post(endpoint(), { + "jsonrpc": "2.0", + "id": 1, + "method": "suix_getCoinMetadata", + "params": [token] + }); + const { data: { result: { value: supply } } } = await axios.post(endpoint(), { + "jsonrpc": "2.0", + "id": 1, + "method": "suix_getTotalSupply", + "params": [token] + }); + return supply / 10 ** decimals; +} \ No newline at end of file diff --git a/src/adapters/peggedAssets/helper/terra.js b/src/adapters/peggedAssets/helper/terra.js deleted file mode 100644 index db2acff6..00000000 --- a/src/adapters/peggedAssets/helper/terra.js +++ /dev/null @@ -1,3 +0,0 @@ -const terra = require("../llama-helper/terra"); - -module.exports = terra; diff --git a/src/adapters/peggedAssets/helper/utils.js b/src/adapters/peggedAssets/helper/utils.js index 136563a8..a07cd58a 100644 --- a/src/adapters/peggedAssets/helper/utils.js +++ b/src/adapters/peggedAssets/helper/utils.js @@ -1,3 +1,180 @@ -const utils = require("../llama-helper/utils"); +const BigNumber = require("bignumber.js"); +const retry = require('async-retry') +const axios = require("axios"); +const sdk = require('@defillama/sdk') +const http = require('./http') -module.exports = utils; +async function returnBalance(token, address, block, chain) { + const { output: decimals } = await sdk.api.erc20.decimals(token, chain) + let { output: balance } = await sdk.api.erc20.balanceOf({ target: token, owner: address, chain, block }) + balance = await new BigNumber(balance).div(10 ** decimals).toFixed(2); + return parseFloat(balance); +} + +async function returnEthBalance(address) { + const output = await sdk.api.eth.getBalance({ target: address }) + let ethAmount = await new BigNumber(output.output).div(10 ** 18).toFixed(2); + return parseFloat(ethAmount); +} + +async function getPrices(object) { + var stringFetch = ''; + for (var key in object[0]) { + if (object[0][key] != 'stable') { + if (stringFetch.length > 0) { + stringFetch = stringFetch + ',' + object[0][key]; + } else { + stringFetch = object[0][key]; + } + } + } + return fetchURL(`https://api.coingecko.com/api/v3/simple/price?ids=${stringFetch}&vs_currencies=usd&include_market_cap=true&include_24hr_vol=true&include_24hr_change=true`) +} + +async function getPricesFromContract(object) { + var contractFetch = '' + for (var key in object) { + if (object[key]) { + if (contractFetch.length > 0) { + contractFetch = contractFetch + ',' + object[key]; + } else { + contractFetch = object[key]; + } + } + } + return fetchURL(`https://api.coingecko.com/api/v3/simple/token_price/ethereum?contract_addresses=${contractFetch}&vs_currencies=usd&include_market_cap=true&include_24hr_vol=true&include_24hr_change=true`) +} + +async function getPricesfromString(stringFeed) { + return fetchURL(`https://api.coingecko.com/api/v3/simple/price?ids=${stringFeed}&vs_currencies=usd&include_market_cap=true&include_24hr_vol=true&include_24hr_change=true`) +} + + +async function fetchURL(url) { + return retry(async bail => await axios.get(url), { + retries: 3 + }) +} + +async function postURL(url, data) { + return retry(async bail => await axios.post(url, data), { + retries: 3 + }) +} + +function createIncrementArray(length) { + const arr = [] + for (let i = 0; i < length; i++) + arr.push(i) + + return arr +} + +const LP_SYMBOLS = ['SLP', 'spLP', 'JLP', 'OLP', 'SCLP', 'DLP', 'MLP', 'MSLP', 'ULP', 'TLP', 'HMDX', 'YLP', 'SCNRLP', 'PGL', 'GREEN-V2', 'PNDA-V2', 'vTAROT', 'TETHYSLP', 'BAO-V2', 'DINO-V2', 'DFYNLP', 'LavaSwap', 'RLP'] +const blacklisted_LPS = [ + '0xb3dc4accfe37bd8b3c2744e9e687d252c9661bc7', + '0xf146190e4d3a2b9abe8e16636118805c628b94fe', +].map(i => i.toLowerCase()) + +function isLP(symbol, token, chain) { + if (token && blacklisted_LPS.includes(token.toLowerCase())) return false + if (chain === 'bsc' && ['OLP', 'DLP', 'MLP', 'LP'].includes(symbol)) return false + if (chain === 'metis' && ['NLP'].includes(symbol)) return true // Netswap LP Token + if (!symbol) return false + let label + + if (symbol.startsWith('ZLK-LP') || symbol.includes('DMM-LP') || (chain === 'avax' && 'DLP' === symbol)) + label = 'Blackisting this LP because of unsupported abi' + + if (label) { + if (DEBUG_MODE) console.log(label, token, symbol) + return false + } + + return LP_SYMBOLS.includes(symbol) || /(UNI-V2)/.test(symbol) || symbol.split(/\W+/).includes('LP') +} + +function mergeExports(...exportsArray) { + exportsArray = exportsArray.flat() + const exports = {} + + exportsArray.forEach(exportObj => { + Object.keys(exportObj).forEach(key => { + if (typeof exportObj[key] !== 'object') { + exports[key] = exportObj[key] + return; + } + Object.keys(exportObj[key]).forEach(key1 => addToExports(key, key1, exportObj[key][key1])) + }) + }) + + Object.keys(exports) + .filter(chain => typeof exports[chain] === 'object') + .forEach(chain => { + const obj = exports[chain] + Object.keys(obj).forEach(key => { + if (obj[key].length > 1) + obj[key] = sdk.util.sumChainTvls(obj[key]) + else + obj[key] = obj[key][0] + }) + }) + + + return exports + + function addToExports(chain, key, fn) { + if (!exports[chain]) exports[chain] = {} + if (!exports[chain][key]) exports[chain][key] = [] + exports[chain][key].push(fn) + } +} + +async function getBalance(chain, account) { + switch (chain) { + case 'bitcoin': + return (await http.get(`https://chain.api.btc.com/v3/address/${account}`)).data.balance / 1e8 + default: throw new Error('Unsupported chain') + } +} + +function getUniqueAddresses(addresses) { + const set = new Set() + addresses.forEach(i => set.add(i.toLowerCase())) + return [...set] +} + +const DEBUG_MODE = !!process.env.LLAMA_DEBUG_MODE + +function log(...args) { + if (DEBUG_MODE) { + console.log(...args); + } +} + +function sliceIntoChunks(arr, chunkSize = 100) { + const res = []; + for (let i = 0; i < arr.length; i += chunkSize) { + const chunk = arr.slice(i, i + chunkSize); + res.push(chunk); + } + return res; +} + +module.exports = { + DEBUG_MODE, + log, + createIncrementArray, + fetchURL, + postURL, + getPricesfromString, + getPrices, + returnBalance, + returnEthBalance, + getPricesFromContract, + isLP, + mergeExports, + getBalance, + getUniqueAddresses, + sliceIntoChunks, +} diff --git a/src/adapters/peggedAssets/llama-helper/CosmWasm.js b/src/adapters/peggedAssets/llama-helper/CosmWasm.js deleted file mode 100644 index 6d069d6d..00000000 --- a/src/adapters/peggedAssets/llama-helper/CosmWasm.js +++ /dev/null @@ -1,60 +0,0 @@ -const { get } = require('./http') -const EnigmaUtils = require('./utils/enigma') -const { toBase64, fromBase64, toUtf8, fromUtf8, toHex, } = EnigmaUtils - -class CosmWasmClient { - constructor(nodeURL) { - this.nodeURL = nodeURL - this.codeHashCache = {} - this.enigmautils = new EnigmaUtils(nodeURL) - } - - async getHeight() { - const latest = await this.get('/blocks/latest') - return parseInt(latest.block.header.height, 10) - } - - async queryContractSmart(contractAddress, query, addedParams) { - const contractCodeHash = await this.getCodeHashByContractAddr(contractAddress); - const encrypted = await this.enigmautils.encrypt(contractCodeHash, query); - const nonce = encrypted.slice(0, 32); - const encoded = toHex(toUtf8(toBase64(encrypted))); - // @ts-ignore - const paramString = new URLSearchParams(addedParams).toString(); - const path = `/wasm/contract/${contractAddress}/query/${encoded}?encoding=hex&${paramString}`; - let responseData = (await this.get(path)) - // By convention, smart queries must return a valid JSON document (see https://github.com/CosmWasm/cosmwasm/issues/144) - return JSON.parse(fromUtf8(fromBase64(fromUtf8(await this.enigmautils.decrypt(fromBase64(responseData.result.smart), nonce))))); - - } - - async get(api) { - return get(this.nodeURL + api) - } - - async getContracts(codeId) { - const path = `/wasm/code/${codeId}/contracts`; - const responseData = (await this.get(path)); - const result = responseData.result || []; - return result.map((entry) => ({ - address: entry.address, - codeId: entry.code_id, - creator: entry.creator, - label: entry.label, - })); - } - - async getCodeHashByContractAddr(addr) { - const codeHashFromCache = this.codeHashCache[addr]; - if (typeof codeHashFromCache === "string") - return codeHashFromCache; - - const path = `/wasm/contract/${addr}/code-hash`; - const responseData = await this.get(path); - this.codeHashCache[addr] = responseData.result - return responseData.result; - } - -} - -module.exports = CosmWasmClient \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/aave.js b/src/adapters/peggedAssets/llama-helper/aave.js deleted file mode 100644 index 606e83d6..00000000 --- a/src/adapters/peggedAssets/llama-helper/aave.js +++ /dev/null @@ -1,129 +0,0 @@ -const sdk = require('@defillama/sdk'); -const { default: BigNumber } = require('bignumber.js'); -const abi = require('./abis/aave.json'); -const { getBlock } = require('./getBlock'); - -async function getV2Reserves(block, addressesProviderRegistry, chain, dataHelperAddress) { - let validProtocolDataHelpers - if (dataHelperAddress === undefined) { - const addressesProviders = ( - await sdk.api.abi.call({ - target: addressesProviderRegistry, - abi: abi["getAddressesProvidersList"], - block, - chain - }) - ).output; - - const protocolDataHelpers = ( - await sdk.api.abi.multiCall({ - calls: addressesProviders.map((provider) => ({ - target: provider, - params: "0x0100000000000000000000000000000000000000000000000000000000000000", - })), - abi: abi["getAddress"], - block, - chain - }) - ).output; - - validProtocolDataHelpers = protocolDataHelpers.filter( - (helper) => - helper.output !== "0x0000000000000000000000000000000000000000" - ).map(p => p.output); - } else { - validProtocolDataHelpers = dataHelperAddress - } - - const aTokenMarketData = ( - await sdk.api.abi.multiCall({ - calls: validProtocolDataHelpers.map((dataHelper) => ({ - target: dataHelper, - })), - abi: abi["getAllATokens"], - block, - chain - }) - ).output; - - let aTokenAddresses = []; - aTokenMarketData.map((aTokensData) => { - aTokenAddresses = [ - ...aTokenAddresses, - ...aTokensData.output.map((aToken) => aToken[1]), - ]; - }); - - const underlyingAddressesData = ( - await sdk.api.abi.multiCall({ - calls: aTokenAddresses.map((aToken) => ({ - target: aToken, - })), - abi: abi["getUnderlying"], - block, - chain - }) - ).output; - - const reserveAddresses = underlyingAddressesData.map((reserveData) => reserveData.output); - - return [aTokenAddresses, reserveAddresses, validProtocolDataHelpers[0]] -} - -async function getTvl(balances, block, chain, v2Atokens, v2ReserveTokens, transformAddress) { - const balanceOfUnderlying = await sdk.api.abi.multiCall({ - calls: v2Atokens.map((aToken, index) => ({ - target: v2ReserveTokens[index], - params: aToken, - })), - abi: "erc20:balanceOf", - block, - chain - }); - sdk.util.sumMultiBalanceOf(balances, balanceOfUnderlying, true, transformAddress) -} - -async function getBorrowed(balances, block, chain, v2ReserveTokens, dataHelper, transformAddress, v3 = false) { - const reserveData = await sdk.api.abi.multiCall({ - calls: v2ReserveTokens.map((token) => ({ - target: dataHelper, - params: [token], - })), - abi: v3 ? abi.getTotalDebt : abi.getHelperReserveData, - block, - chain - }); - - reserveData.output.forEach((data, idx)=>{ - const quantity = v3 ? data.output : BigNumber(data.output.totalVariableDebt).plus(data.output.totalStableDebt).toFixed(0) - sdk.util.sumSingleBalance(balances, transformAddress(data.input.params[0]), quantity) - }) -} - -function aaveChainTvl(chain, addressesProviderRegistry, transformAddressRaw, dataHelperAddresses, borrowed, v3 = false) { - const transformAddress = transformAddressRaw ? transformAddressRaw : addr=>`${chain}:${addr}` - return async (timestamp, ethBlock, chainBlocks) => { - const balances = {} - const block = await getBlock(timestamp, chain, chainBlocks, true); - const [v2Atokens, v2ReserveTokens, dataHelper] = await getV2Reserves(block, addressesProviderRegistry, chain, dataHelperAddresses) - if(borrowed){ - await getBorrowed(balances, block, chain, v2ReserveTokens, dataHelper, transformAddress, v3); - } else { - await getTvl(balances, block, chain, v2Atokens, v2ReserveTokens, transformAddress); - } - return balances - } -} -function aaveExports(chain, addressesProviderRegistry, transform = undefined, dataHelpers = undefined){ - return { - tvl: aaveChainTvl(chain, addressesProviderRegistry, transform, dataHelpers, false), - borrowed: aaveChainTvl(chain, addressesProviderRegistry, transform, dataHelpers, true) - } -} -module.exports = { - aaveChainTvl, - getV2Reserves, - getTvl, - aaveExports, - getBorrowed, -} \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/abis/aave.json b/src/adapters/peggedAssets/llama-helper/abis/aave.json deleted file mode 100644 index e1f8e5f3..00000000 --- a/src/adapters/peggedAssets/llama-helper/abis/aave.json +++ /dev/null @@ -1,521 +0,0 @@ -{ - "getTotalDebt": { - "inputs": [ - { - "internalType": "address", - "name": "asset", - "type": "address" - } - ], - "name": "getTotalDebt", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getReservesList": { - "inputs": [], - "name": "getReservesList", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getAMMReserveData": { - "inputs": [ - { - "internalType": "address", - "name": "asset", - "type": "address" - } - ], - "name": "getReserveData", - "outputs": [ - { - "components": [ - { - "components": [ - { - "internalType": "uint256", - "name": "data", - "type": "uint256" - } - ], - "internalType": "struct DataTypes.ReserveConfigurationMap", - "name": "configuration", - "type": "tuple" - }, - { - "internalType": "uint128", - "name": "liquidityIndex", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "variableBorrowIndex", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "currentLiquidityRate", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "currentVariableBorrowRate", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "currentStableBorrowRate", - "type": "uint128" - }, - { - "internalType": "uint40", - "name": "lastUpdateTimestamp", - "type": "uint40" - }, - { - "internalType": "address", - "name": "aTokenAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "stableDebtTokenAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "variableDebtTokenAddress", - "type": "address" - }, - { - "internalType": "address", - "name": "interestRateStrategyAddress", - "type": "address" - }, - { - "internalType": "uint8", - "name": "id", - "type": "uint8" - } - ], - "internalType": "struct DataTypes.ReserveData", - "name": "", - "type": "tuple" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getCurrentTokens": { - "constant": true, - "inputs": [], - "name": "getCurrentTokens", - "outputs": [ - { - "internalType": "address[]", - "name": "tokens", - "type": "address[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "getReserveData": { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "_reserve", - "type": "address" - } - ], - "name": "getReserveData", - "outputs": [ - { - "internalType": "uint256", - "name": "totalLiquidity", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "availableLiquidity", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalBorrowsStable", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalBorrowsVariable", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidityRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "variableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "stableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "averageStableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "utilizationRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidityIndex", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "variableBorrowIndex", - "type": "uint256" - }, - { - "internalType": "address", - "name": "aTokenAddress", - "type": "address" - }, - { - "internalType": "uint40", - "name": "lastUpdateTimestamp", - "type": "uint40" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "getReserveConfigurationData": { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "_reserve", - "type": "address" - } - ], - "name": "getReserveConfigurationData", - "outputs": [ - { - "internalType": "uint256", - "name": "ltv", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidationThreshold", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidationBonus", - "type": "uint256" - }, - { - "internalType": "address", - "name": "interestRateStrategyAddress", - "type": "address" - }, - { - "internalType": "bool", - "name": "usageAsCollateralEnabled", - "type": "bool" - }, - { - "internalType": "bool", - "name": "borrowingEnabled", - "type": "bool" - }, - { - "internalType": "bool", - "name": "stableBorrowRateEnabled", - "type": "bool" - }, - { - "internalType": "bool", - "name": "isActive", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "getReserves": { - "constant": true, - "inputs": [], - "name": "getReserves", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "getAddressesProvidersList": { - "inputs": [], - "name": "getAddressesProvidersList", - "outputs": [ - { - "internalType": "address[]", - "name": "", - "type": "address[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getAddress": { - "inputs": [ - { - "internalType": "bytes32", - "name": "id", - "type": "bytes32" - } - ], - "name": "getAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getAllATokens": { - "inputs": [], - "name": "getAllATokens", - "outputs": [ - { - "components": [ - { - "internalType": "string", - "name": "symbol", - "type": "string" - }, - { - "internalType": "address", - "name": "tokenAddress", - "type": "address" - } - ], - "internalType": "struct AaveProtocolDataProvider.TokenData[]", - "name": "", - "type": "tuple[]" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getUnderlying": { - "inputs": [], - "name": "UNDERLYING_ASSET_ADDRESS", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getReserveDataV2": { - "inputs": [ - { - "internalType": "address", - "name": "asset", - "type": "address" - } - ], - "name": "getReserveData", - "outputs": [ - { - "internalType": "uint256", - "name": "availableLiquidity", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalStableDebt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalVariableDebt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidityRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "variableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "stableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "averageStableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidityIndex", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "variableBorrowIndex", - "type": "uint256" - }, - { - "internalType": "uint40", - "name": "lastUpdateTimestamp", - "type": "uint40" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getBPool": { - "inputs": [], - "name": "bPool", - "outputs": [ - { - "internalType": "contract IBPool", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getHelperReserveData": { - "inputs": [ - { - "internalType": "address", - "name": "asset", - "type": "address" - } - ], - "name": "getReserveData", - "outputs": [ - { - "internalType": "uint256", - "name": "availableLiquidity", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalStableDebt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "totalVariableDebt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidityRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "variableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "stableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "averageStableBorrowRate", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidityIndex", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "variableBorrowIndex", - "type": "uint256" - }, - { - "internalType": "uint40", - "name": "lastUpdateTimestamp", - "type": "uint40" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getReserveTotalBorrows": { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "_reserve", - "type": "address" - } - ], - "name": "getReserveTotalBorrows", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -} \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/abis/balancer.json b/src/adapters/peggedAssets/llama-helper/abis/balancer.json deleted file mode 100644 index ff5e8eff..00000000 --- a/src/adapters/peggedAssets/llama-helper/abis/balancer.json +++ /dev/null @@ -1,44 +0,0 @@ -{ - "getPoolTokens": { - "inputs": [ - { - "internalType": "bytes32", - "name": "poolId", - "type": "bytes32" - } - ], - "name": "getPoolTokens", - "outputs": [ - { - "internalType": "contract IERC20[]", - "name": "tokens", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "balances", - "type": "uint256[]" - }, - { - "internalType": "uint256", - "name": "lastChangeBlock", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getPoolId": { - "inputs": [], - "name": "getPoolId", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - } -} \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/abis/blindex.json b/src/adapters/peggedAssets/llama-helper/abis/blindex.json deleted file mode 100644 index b6b4c9cf..00000000 --- a/src/adapters/peggedAssets/llama-helper/abis/blindex.json +++ /dev/null @@ -1,92 +0,0 @@ -{ - "bdstable_pools_array": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "bdstable_pools_array", - "outputs": [ - { - "internalType": "address payable", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getBdStablesPoolsLength": { - "inputs": [], - "name": "getBdStablesPoolsLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getBDStablePoolCollateral": { - "inputs": [], - "name": "collateral_token", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getBDStable": { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "bdstables", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getBdStablesLength": { - "inputs": [], - "name": "getBdStablesLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - "getBDXPriceUsdD12": { - "inputs": [], - "name": "BDX_price_d12", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -} diff --git a/src/adapters/peggedAssets/llama-helper/abis/brahmafi-aastra.json b/src/adapters/peggedAssets/llama-helper/abis/brahmafi-aastra.json deleted file mode 100644 index 4db6c23c..00000000 --- a/src/adapters/peggedAssets/llama-helper/abis/brahmafi-aastra.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "getTotalAmounts": { - "inputs": [], - "name": "getTotalAmounts", - "outputs": [ - { "internalType": "uint256", "name": "total0", "type": "uint256" }, - { "internalType": "uint256", "name": "total1", "type": "uint256" } - ], - "stateMutability": "view", - "type": "function" - } -} diff --git a/src/adapters/peggedAssets/llama-helper/abis/compound.json b/src/adapters/peggedAssets/llama-helper/abis/compound.json deleted file mode 100644 index 299d8079..00000000 --- a/src/adapters/peggedAssets/llama-helper/abis/compound.json +++ /dev/null @@ -1,183 +0,0 @@ -{ - "markets": { - "constant":true, - "inputs":[ - { - "name":"", - "type":"address" - } - ], - "name":"markets", - "outputs":[ - { - "name":"isSupported", - "type":"bool" - }, - { - "name":"blockNumber", - "type":"uint256" - }, - { - "name":"interestRateModel", - "type":"address" - }, - { - "name":"totalSupply", - "type":"uint256" - }, - { - "name":"supplyRateMantissa", - "type":"uint256" - }, - { - "name":"supplyIndex", - "type":"uint256" - }, - { - "name":"totalBorrows", - "type":"uint256" - }, - { - "name":"borrowRateMantissa", - "type":"uint256" - }, - { - "name":"borrowIndex", - "type":"uint256" - } - ], - "payable":false, - "stateMutability":"view", - "type":"function" - }, - "totalBorrows": { - "constant":true, - "inputs":[ - - ], - "name":"totalBorrows", - "outputs":[ - { - "name":"", - "type":"uint256" - } - ], - "payable":false, - "stateMutability":"view", - "type":"function" - }, - "borrowRatePerBlock": { - "constant":true, - "inputs":[ - - ], - "name":"borrowRatePerBlock", - "outputs":[ - { - "name":"", - "type":"uint256" - } - ], - "payable":false, - "stateMutability":"view", - "type":"function" - }, - "supplyRatePerBlock": { - "constant":true, - "inputs":[ - - ], - "name":"supplyRatePerBlock", - "outputs":[ - { - "name":"", - "type":"uint256" - } - ], - "payable":false, - "stateMutability":"view", - "type":"function" - }, - "underlying": { - "constant": true, - "inputs": [], - "name": "underlying", - "outputs": [ - { - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function", - "signature": "0x6f307dc3" - }, - "getCash": { - "constant": true, - "inputs": [], - "name": "getCash", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "signature": "0x3b1d21a2", - "stateMutability": "view", - "type": "function" - }, - "getAllMarkets": { - "constant": true, - "inputs": [], - "name": "getAllMarkets", - "outputs": [ - { - "internalType": "contract CToken[]", - "name": "", - "type": "address[]" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function", - "signature": "0xb0772d0b" - }, - "getUnderlyingPrice": - { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "_pToken", - "type": "address" - } - ], - "name": "getUnderlyingPrice", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "oracle": - { - "inputs": [], - "name": "oracle", - "outputs": [ - { - "internalType": "contract IPriceOracle", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } -} diff --git a/src/adapters/peggedAssets/llama-helper/abis/cream.json b/src/adapters/peggedAssets/llama-helper/abis/cream.json deleted file mode 100644 index 0ef3b82e..00000000 --- a/src/adapters/peggedAssets/llama-helper/abis/cream.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "underlying": { - "constant": true, - "inputs": [], - "name": "underlying", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "exchangeRateStored": { - "constant": true, - "inputs": [], - "name": "exchangeRateStored", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - } -} \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/abis/dodo.json b/src/adapters/peggedAssets/llama-helper/abis/dodo.json deleted file mode 100644 index 3c96e622..00000000 --- a/src/adapters/peggedAssets/llama-helper/abis/dodo.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "_BASE_TOKEN_": { - "inputs": [], - "name": "_BASE_TOKEN_", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - "_QUOTE_TOKEN_": { - "inputs": [], - "name": "_QUOTE_TOKEN_", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } -} \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/abis/erc20.json b/src/adapters/peggedAssets/llama-helper/abis/erc20.json deleted file mode 100644 index 15be39c0..00000000 --- a/src/adapters/peggedAssets/llama-helper/abis/erc20.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "balanceOf": { - "inputs": [ - { "internalType": "address", "name": "account", "type": "address" } - ], - "name": "balanceOf", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - "symbol": { - "type": "function", - "stateMutability": "view", - "payable": false, - "outputs": [{ "type": "string", "name": "" }], - "name": "symbol", - "inputs": [], - "constant": true - }, - "name": { - "type": "function", - "stateMutability": "view", - "payable": false, - "outputs": [ - { - "type": "string", - "name": "" - } - ], - "name": "name", - "inputs": [], - "constant": true - } -} diff --git a/src/adapters/peggedAssets/llama-helper/abis/factory.json b/src/adapters/peggedAssets/llama-helper/abis/factory.json deleted file mode 100644 index 7f6c371f..00000000 --- a/src/adapters/peggedAssets/llama-helper/abis/factory.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "allPairs": { - "constant": true, - "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "name": "allPairs", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - "allPairsLength": { - "constant": true, - "inputs": [], - "name": "allPairsLength", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - } -} diff --git a/src/adapters/peggedAssets/llama-helper/abis/getEntireSystemColl.abi.json b/src/adapters/peggedAssets/llama-helper/abis/getEntireSystemColl.abi.json deleted file mode 100644 index 15a2c6c0..00000000 --- a/src/adapters/peggedAssets/llama-helper/abis/getEntireSystemColl.abi.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "inputs": [], - "name": "getEntireSystemColl", - "outputs": [ - { - "internalType": "uint256", - "name": "entireSystemColl", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" -} \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/abis/getPair.json b/src/adapters/peggedAssets/llama-helper/abis/getPair.json deleted file mode 100644 index 6d838800..00000000 --- a/src/adapters/peggedAssets/llama-helper/abis/getPair.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "getPair", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" -} \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/abis/getPricePerShare.json b/src/adapters/peggedAssets/llama-helper/abis/getPricePerShare.json deleted file mode 100644 index 92340766..00000000 --- a/src/adapters/peggedAssets/llama-helper/abis/getPricePerShare.json +++ /dev/null @@ -1,31 +0,0 @@ -[ - { - "constant": true, - "inputs": [], - "name": "getPricePerFullShare", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function", - "signature": "0x77c7b8fc" - }, - { - "name": "pricePerShare", - "outputs": [ - { - "type": "uint256", - "name": "" - } - ], - "inputs": [], - "stateMutability": "view", - "type": "function", - "gas": 12412 - } -] \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/abis/getReserves.json b/src/adapters/peggedAssets/llama-helper/abis/getReserves.json deleted file mode 100644 index e3f6fcc1..00000000 --- a/src/adapters/peggedAssets/llama-helper/abis/getReserves.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "constant": true, - "inputs": [], - "name": "getReserves", - "outputs": [ - { - "internalType": "uint112", - "name": "_reserve0", - "type": "uint112" - }, - { - "internalType": "uint112", - "name": "_reserve1", - "type": "uint112" - }, - { - "internalType": "uint32", - "name": "_blockTimestampLast", - "type": "uint32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" -} diff --git a/src/adapters/peggedAssets/llama-helper/abis/kashipair.json b/src/adapters/peggedAssets/llama-helper/abis/kashipair.json deleted file mode 100644 index 16b57604..00000000 --- a/src/adapters/peggedAssets/llama-helper/abis/kashipair.json +++ /dev/null @@ -1,20 +0,0 @@ -[ - { - "inputs": [], - "name": "totalBorrow", - "outputs": [ - { - "internalType": "uint128", - "name": "elastic", - "type": "uint128" - }, - { - "internalType": "uint128", - "name": "base", - "type": "uint128" - } - ], - "stateMutability": "view", - "type": "function" - } -] \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/abis/masterchef.json b/src/adapters/peggedAssets/llama-helper/abis/masterchef.json deleted file mode 100644 index fdb8dcde..00000000 --- a/src/adapters/peggedAssets/llama-helper/abis/masterchef.json +++ /dev/null @@ -1,35 +0,0 @@ -{ - "poolInfo": { - "type": "function", - "stateMutability": "view", - "outputs": [ - { - "type": "address", - "name": "lpToken", - "internalType": "contract IERC20" - }, - { "type": "uint256", "name": "allocPoint", "internalType": "uint256" }, - { - "type": "uint256", - "name": "lastRewardBlock", - "internalType": "uint256" - }, - { - "type": "uint256", - "name": "accFishPerShare", - "internalType": "uint256" - }, - { "type": "uint16", "name": "depositFeeBP", "internalType": "uint16" } - ], - "name": "poolInfo", - "inputs": [{ "type": "uint256", "name": "", "internalType": "uint256" }] - }, - "poolLength": { - "type": "function", - "stateMutability": "view", - "outputs": [{ "type": "uint256", "name": "", "internalType": "uint256" }], - "name": "poolLength", - "inputs": [] - } - } - \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/abis/symbol.json b/src/adapters/peggedAssets/llama-helper/abis/symbol.json deleted file mode 100644 index 663f4129..00000000 --- a/src/adapters/peggedAssets/llama-helper/abis/symbol.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "constant": true, - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" -} \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/abis/token.json b/src/adapters/peggedAssets/llama-helper/abis/token.json deleted file mode 100644 index 3c00d06d..00000000 --- a/src/adapters/peggedAssets/llama-helper/abis/token.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "inputs": [], - "name": "token", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" -} diff --git a/src/adapters/peggedAssets/llama-helper/abis/token0.json b/src/adapters/peggedAssets/llama-helper/abis/token0.json deleted file mode 100644 index eefbeb99..00000000 --- a/src/adapters/peggedAssets/llama-helper/abis/token0.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "constant": true, - "inputs": [], - "name": "token0", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" -} diff --git a/src/adapters/peggedAssets/llama-helper/abis/token1.json b/src/adapters/peggedAssets/llama-helper/abis/token1.json deleted file mode 100644 index cccef25f..00000000 --- a/src/adapters/peggedAssets/llama-helper/abis/token1.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "constant": true, - "inputs": [], - "name": "token1", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" -} diff --git a/src/adapters/peggedAssets/llama-helper/abis/userInfo.json b/src/adapters/peggedAssets/llama-helper/abis/userInfo.json deleted file mode 100644 index 27e9048a..00000000 --- a/src/adapters/peggedAssets/llama-helper/abis/userInfo.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "inputs": [{ - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "userInfo", - "outputs": [{ - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "rewardDebt", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" -} diff --git a/src/adapters/peggedAssets/llama-helper/alchemixHelper.js b/src/adapters/peggedAssets/llama-helper/alchemixHelper.js deleted file mode 100644 index af31da31..00000000 --- a/src/adapters/peggedAssets/llama-helper/alchemixHelper.js +++ /dev/null @@ -1,186 +0,0 @@ -const web3 = require("../config/web3.js"); - -const BigNumber = require("bignumber.js"); - -const abis = require("../config/abis.js"); -const curveAbi = JSON.parse( - '[{"name":"Transfer","inputs":[{"type":"address","name":"sender","indexed":true},{"type":"address","name":"receiver","indexed":true},{"type":"uint256","name":"value","indexed":false}],"anonymous":false,"type":"event"},{"name":"Approval","inputs":[{"type":"address","name":"owner","indexed":true},{"type":"address","name":"spender","indexed":true},{"type":"uint256","name":"value","indexed":false}],"anonymous":false,"type":"event"},{"name":"TokenExchange","inputs":[{"type":"address","name":"buyer","indexed":true},{"type":"int128","name":"sold_id","indexed":false},{"type":"uint256","name":"tokens_sold","indexed":false},{"type":"int128","name":"bought_id","indexed":false},{"type":"uint256","name":"tokens_bought","indexed":false}],"anonymous":false,"type":"event"},{"name":"TokenExchangeUnderlying","inputs":[{"type":"address","name":"buyer","indexed":true},{"type":"int128","name":"sold_id","indexed":false},{"type":"uint256","name":"tokens_sold","indexed":false},{"type":"int128","name":"bought_id","indexed":false},{"type":"uint256","name":"tokens_bought","indexed":false}],"anonymous":false,"type":"event"},{"name":"AddLiquidity","inputs":[{"type":"address","name":"provider","indexed":true},{"type":"uint256[2]","name":"token_amounts","indexed":false},{"type":"uint256[2]","name":"fees","indexed":false},{"type":"uint256","name":"invariant","indexed":false},{"type":"uint256","name":"token_supply","indexed":false}],"anonymous":false,"type":"event"},{"name":"RemoveLiquidity","inputs":[{"type":"address","name":"provider","indexed":true},{"type":"uint256[2]","name":"token_amounts","indexed":false},{"type":"uint256[2]","name":"fees","indexed":false},{"type":"uint256","name":"token_supply","indexed":false}],"anonymous":false,"type":"event"},{"name":"RemoveLiquidityOne","inputs":[{"type":"address","name":"provider","indexed":true},{"type":"uint256","name":"token_amount","indexed":false},{"type":"uint256","name":"coin_amount","indexed":false},{"type":"uint256","name":"token_supply","indexed":false}],"anonymous":false,"type":"event"},{"name":"RemoveLiquidityImbalance","inputs":[{"type":"address","name":"provider","indexed":true},{"type":"uint256[2]","name":"token_amounts","indexed":false},{"type":"uint256[2]","name":"fees","indexed":false},{"type":"uint256","name":"invariant","indexed":false},{"type":"uint256","name":"token_supply","indexed":false}],"anonymous":false,"type":"event"},{"name":"CommitNewAdmin","inputs":[{"type":"uint256","name":"deadline","indexed":true},{"type":"address","name":"admin","indexed":true}],"anonymous":false,"type":"event"},{"name":"NewAdmin","inputs":[{"type":"address","name":"admin","indexed":true}],"anonymous":false,"type":"event"},{"name":"CommitNewFee","inputs":[{"type":"uint256","name":"deadline","indexed":true},{"type":"uint256","name":"fee","indexed":false},{"type":"uint256","name":"admin_fee","indexed":false}],"anonymous":false,"type":"event"},{"name":"NewFee","inputs":[{"type":"uint256","name":"fee","indexed":false},{"type":"uint256","name":"admin_fee","indexed":false}],"anonymous":false,"type":"event"},{"name":"RampA","inputs":[{"type":"uint256","name":"old_A","indexed":false},{"type":"uint256","name":"new_A","indexed":false},{"type":"uint256","name":"initial_time","indexed":false},{"type":"uint256","name":"future_time","indexed":false}],"anonymous":false,"type":"event"},{"name":"StopRampA","inputs":[{"type":"uint256","name":"A","indexed":false},{"type":"uint256","name":"t","indexed":false}],"anonymous":false,"type":"event"},{"outputs":[],"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"name":"initialize","outputs":[],"inputs":[{"type":"string","name":"_name"},{"type":"string","name":"_symbol"},{"type":"address","name":"_coin"},{"type":"uint256","name":"_decimals"},{"type":"uint256","name":"_A"},{"type":"uint256","name":"_fee"},{"type":"address","name":"_admin"}],"stateMutability":"nonpayable","type":"function","gas":470049},{"name":"decimals","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":291},{"name":"transfer","outputs":[{"type":"bool","name":""}],"inputs":[{"type":"address","name":"_to"},{"type":"uint256","name":"_value"}],"stateMutability":"nonpayable","type":"function","gas":75402},{"name":"transferFrom","outputs":[{"type":"bool","name":""}],"inputs":[{"type":"address","name":"_from"},{"type":"address","name":"_to"},{"type":"uint256","name":"_value"}],"stateMutability":"nonpayable","type":"function","gas":112037},{"name":"approve","outputs":[{"type":"bool","name":""}],"inputs":[{"type":"address","name":"_spender"},{"type":"uint256","name":"_value"}],"stateMutability":"nonpayable","type":"function","gas":37854},{"name":"get_previous_balances","outputs":[{"type":"uint256[2]","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":2254},{"name":"get_balances","outputs":[{"type":"uint256[2]","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":2284},{"name":"get_twap_balances","outputs":[{"type":"uint256[2]","name":""}],"inputs":[{"type":"uint256[2]","name":"_first_balances"},{"type":"uint256[2]","name":"_last_balances"},{"type":"uint256","name":"_time_elapsed"}],"stateMutability":"view","type":"function","gas":1522},{"name":"get_price_cumulative_last","outputs":[{"type":"uint256[2]","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":2344},{"name":"admin_fee","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":621},{"name":"A","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":5859},{"name":"A_precise","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":5821},{"name":"get_virtual_price","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":1011891},{"name":"calc_token_amount","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"uint256[2]","name":"_amounts"},{"type":"bool","name":"_is_deposit"}],"stateMutability":"view","type":"function"},{"name":"calc_token_amount","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"uint256[2]","name":"_amounts"},{"type":"bool","name":"_is_deposit"},{"type":"bool","name":"_previous"}],"stateMutability":"view","type":"function"},{"name":"add_liquidity","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"uint256[2]","name":"_amounts"},{"type":"uint256","name":"_min_mint_amount"}],"stateMutability":"nonpayable","type":"function"},{"name":"add_liquidity","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"uint256[2]","name":"_amounts"},{"type":"uint256","name":"_min_mint_amount"},{"type":"address","name":"_receiver"}],"stateMutability":"nonpayable","type":"function"},{"name":"get_dy","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"int128","name":"i"},{"type":"int128","name":"j"},{"type":"uint256","name":"dx"}],"stateMutability":"view","type":"function"},{"name":"get_dy","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"int128","name":"i"},{"type":"int128","name":"j"},{"type":"uint256","name":"dx"},{"type":"uint256[2]","name":"_balances"}],"stateMutability":"view","type":"function"},{"name":"get_dy_underlying","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"int128","name":"i"},{"type":"int128","name":"j"},{"type":"uint256","name":"dx"}],"stateMutability":"view","type":"function"},{"name":"get_dy_underlying","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"int128","name":"i"},{"type":"int128","name":"j"},{"type":"uint256","name":"dx"},{"type":"uint256[2]","name":"_balances"}],"stateMutability":"view","type":"function"},{"name":"exchange","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"int128","name":"i"},{"type":"int128","name":"j"},{"type":"uint256","name":"dx"},{"type":"uint256","name":"min_dy"}],"stateMutability":"nonpayable","type":"function"},{"name":"exchange","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"int128","name":"i"},{"type":"int128","name":"j"},{"type":"uint256","name":"dx"},{"type":"uint256","name":"min_dy"},{"type":"address","name":"_receiver"}],"stateMutability":"nonpayable","type":"function"},{"name":"exchange_underlying","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"int128","name":"i"},{"type":"int128","name":"j"},{"type":"uint256","name":"dx"},{"type":"uint256","name":"min_dy"}],"stateMutability":"nonpayable","type":"function"},{"name":"exchange_underlying","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"int128","name":"i"},{"type":"int128","name":"j"},{"type":"uint256","name":"dx"},{"type":"uint256","name":"min_dy"},{"type":"address","name":"_receiver"}],"stateMutability":"nonpayable","type":"function"},{"name":"remove_liquidity","outputs":[{"type":"uint256[2]","name":""}],"inputs":[{"type":"uint256","name":"_burn_amount"},{"type":"uint256[2]","name":"_min_amounts"}],"stateMutability":"nonpayable","type":"function"},{"name":"remove_liquidity","outputs":[{"type":"uint256[2]","name":""}],"inputs":[{"type":"uint256","name":"_burn_amount"},{"type":"uint256[2]","name":"_min_amounts"},{"type":"address","name":"_receiver"}],"stateMutability":"nonpayable","type":"function"},{"name":"remove_liquidity_imbalance","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"uint256[2]","name":"_amounts"},{"type":"uint256","name":"_max_burn_amount"}],"stateMutability":"nonpayable","type":"function"},{"name":"remove_liquidity_imbalance","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"uint256[2]","name":"_amounts"},{"type":"uint256","name":"_max_burn_amount"},{"type":"address","name":"_receiver"}],"stateMutability":"nonpayable","type":"function"},{"name":"calc_withdraw_one_coin","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"uint256","name":"_burn_amount"},{"type":"int128","name":"i"}],"stateMutability":"view","type":"function"},{"name":"calc_withdraw_one_coin","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"uint256","name":"_burn_amount"},{"type":"int128","name":"i"},{"type":"bool","name":"_previous"}],"stateMutability":"view","type":"function"},{"name":"remove_liquidity_one_coin","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"uint256","name":"_burn_amount"},{"type":"int128","name":"i"},{"type":"uint256","name":"_min_received"}],"stateMutability":"nonpayable","type":"function"},{"name":"remove_liquidity_one_coin","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"uint256","name":"_burn_amount"},{"type":"int128","name":"i"},{"type":"uint256","name":"_min_received"},{"type":"address","name":"_receiver"}],"stateMutability":"nonpayable","type":"function"},{"name":"ramp_A","outputs":[],"inputs":[{"type":"uint256","name":"_future_A"},{"type":"uint256","name":"_future_time"}],"stateMutability":"nonpayable","type":"function","gas":152464},{"name":"stop_ramp_A","outputs":[],"inputs":[],"stateMutability":"nonpayable","type":"function","gas":149225},{"name":"admin_balances","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"uint256","name":"i"}],"stateMutability":"view","type":"function","gas":3601},{"name":"withdraw_admin_fees","outputs":[],"inputs":[],"stateMutability":"nonpayable","type":"function","gas":11347},{"name":"admin","outputs":[{"type":"address","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":2141},{"name":"coins","outputs":[{"type":"address","name":""}],"inputs":[{"type":"uint256","name":"arg0"}],"stateMutability":"view","type":"function","gas":2280},{"name":"balances","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"uint256","name":"arg0"}],"stateMutability":"view","type":"function","gas":2310},{"name":"fee","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":2231},{"name":"block_timestamp_last","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":2261},{"name":"initial_A","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":2291},{"name":"future_A","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":2321},{"name":"initial_A_time","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":2351},{"name":"future_A_time","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":2381},{"name":"name","outputs":[{"type":"string","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":8813},{"name":"symbol","outputs":[{"type":"string","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":7866},{"name":"balanceOf","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"address","name":"arg0"}],"stateMutability":"view","type":"function","gas":2686},{"name":"allowance","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"address","name":"arg0"},{"type":"address","name":"arg1"}],"stateMutability":"view","type":"function","gas":2931},{"name":"totalSupply","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":2531}]' -); -const { getTokenPriceCoinGecko } = require("../config/bella/utilities.js"); - -let coins = [ - "0x6b175474e89094c44da98b954eedeac495271d0f", //0 DAI - "0xBC6DA0FE9aD5f3b0d58160288917AA56653660E9", //1 alUSD - "0xdBdb4d16EdA451D0503b854CF79D55697F90c8DF", //2 ALCX - "0xC3f279090a47e80990Fe3a9c30d24Cb117EF91a8", //3 Sushiswap ALCX-WETH LP Token - "0xda816459f1ab5631232fe5e97a05bbbb94970c95", //4 yvDAI - "0x43b4FdFD4Ff969587185cDB6f0BD875c5Fc83f8c", //5 Curve alUSD-3crv LP token - "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", //6 WETH - "0x0100546F2cD4C9D97f798fFC9755E47865FF7Ee6", //7 alETH - "0xa258C4606Ca8206D8aA700cE2143D7db854D168c", //8 yvWETH - "0xc9da65931abf0ed1b74ce5ad8c041c4220940368", //9 Saddle alETH LP token -]; - -let daiHolders = [ - "0xaB7A49B971AFdc7Ee26255038C82b4006D122086", //USDTransmuter - "0xc21D353FF4ee73C572425697f4F5aaD2109fe35b", //USDAlchemist - "0xeE69BD81Bd056339368c97c4B2837B4Dc4b796E7", //USDTransmuterB -]; - -let yvDaiHolders = [ - "0xb039eA6153c827e59b620bDCd974F7bbFe68214A", //USDYearnVaultAdapter (Alchemist) - "0x6Fe02BE0EC79dCF582cBDB936D7037d2eB17F661", //USDYearnVaultAdapterWithIndirection (TransmuterB) -]; - -let wethHolders = [ - "0x9FD9946E526357B35D95Bcb4b388614be4cFd4AC", //ETHTransmuter - "0xf8317BD5F48B6fE608a52B48C856D3367540B73B", //ETHAlchemist -]; - -let yvWethHolders = [ - "0x546E6711032Ec744A7708D4b7b283A210a85B3BC", //ETHYearnVaultAdapter (Alchemist) - "0x6d75657771256C7a8CB4d475fDf5047B70160132", //ETHYearnVaultAdapter (Transmuter) -]; - -async function weiToFloat(wei) { - wei = await new BigNumber(wei).div(10 ** 18).toPrecision(); - return parseFloat(wei); -} - -async function getPricePerShareInFloat(contract) { - let pricePerShare = await contract.methods.pricePerShare().call(); - pricePerShare = await weiToFloat(pricePerShare); - return pricePerShare; -} - -async function getBalInFloat(contract, user) { - let balances = await contract.methods.balanceOf(user).call(); - balances = await weiToFloat(balances); - return balances; -} - -async function getTotalSupplyFloat(contract) { - let supply = await contract.methods.totalSupply().call(); - supply = await weiToFloat(supply); - return supply; -} - -async function getVirtualPriceFloat(contract) { - let virtualPrice = await contract.methods.get_virtual_price().call(); - virtualPrice = await weiToFloat(virtualPrice); - return virtualPrice; -} -const stakingPool = "0xAB8e74017a8Cc7c15FFcCd726603790d26d7DeCa"; // Alchemix Staking Pools -const mcv2 = "0xEF0881eC094552b2e128Cf945EF17a6752B4Ec5d"; // MasterChefV2 -const curveStakingPool = "0xb76256d1091e93976c61449d6e500d9f46d827d4"; // Curve Gauge ALCX Rewards - -const daicontract = new web3.eth.Contract(abis.abis.minABI, coins[0]); -const alusdcontract = new web3.eth.Contract(abis.abis.minABI, coins[1]); -const alcxcontract = new web3.eth.Contract(abis.abis.minABI, coins[2]); -const alcxlpcontract = new web3.eth.Contract(abis.abis.minABI, coins[3]); -const yvDAIContract = new web3.eth.Contract(abis.abis.minYvV2, coins[4]); -const alUSDCurveLPContract = new web3.eth.Contract(curveAbi, coins[5]); -const wethcontract = new web3.eth.Contract(abis.abis.minABI, coins[6]); -const alethContract = new web3.eth.Contract(abis.abis.minABI, coins[7]); -const yvWethContract = new web3.eth.Contract(abis.abis.minYvV2, coins[8]); -const alETHSaddleLPContract = new web3.eth.Contract( - abis.abis.minABI, - coins[9] -); -async function dai(tvl) { - let pricePerYvDai = await getPricePerShareInFloat(yvDAIContract); - - // Get DAI TVL - //Get total DAI TVL from transmuter and alchemist contracts - for (let i = 0; i < daiHolders.length; i++) { - let daibal = await getBalInFloat(daicontract, daiHolders[i]); - tvl += daibal; - } - //Get total DAI TVL from yvDAI holders - for (let i = 0; i < yvDaiHolders.length; i++) { - let ydaibal = await getBalInFloat(yvDAIContract, yvDaiHolders[i]); - tvl += ydaibal * pricePerYvDai; - } - return tvl; -} -async function eth() { - const pricePerYvWeth = await getPricePerShareInFloat(yvWethContract); - - let totalEth = 0; - - // Get ETH TVL - //Get total ETH TVL from transmuter and alchemist contracts - for (let i = 0; i < wethHolders.length; i++) { - let ethbal = await getBalInFloat(wethcontract, wethHolders[i]); - totalEth += ethbal; - } - //Get total ETH TVL from yvWETH holders - for (let i = 0; i < yvWethHolders.length; i++) { - let yethbal = await getBalInFloat(yvWethContract, yvWethHolders[i]); - totalEth += yethbal * pricePerYvWeth; - } - return totalEth -} -async function alcx() { - //Get total amount of ALCX staked in staking pool - const stakedALCX = await getBalInFloat(alcxcontract, stakingPool); - //Convert ALCX to USD Via coingecko - const baseTokenPriceInUsd = await getTokenPriceCoinGecko("usd")("alchemix"); - return stakedALCX * baseTokenPriceInUsd; -} -async function lp(tvl, ethPriceInUsd) { -/* - //Get total amount of SLP staked in staking contract - const stakedLPPool = await getBalInFloat(alcxlpcontract, stakingPool); - const stakedLPMCV2 = await getBalInFloat(alcxlpcontract, mcv2); - const stakedLP = stakedLPPool + stakedLPMCV2; // Add up tokens in original pool plus tokens in mcv2 - //Get amount of ALCX in lp shares - const totalLP = await getTotalSupplyFloat(alcxlpcontract); - let shareOfTotalStaked = stakedLP / totalLP; //Gets ratio of total staked - //Get total ALCX in lp token - const totalALCXinLP = await getBalInFloat(alcxcontract, coins[3]); - let totalALCXShareInLP = shareOfTotalStaked * totalALCXinLP; - //Get approx tvl from lp staking by doubling the alcx * usd price - let slpTVL = totalALCXShareInLP * 2 * baseTokenPriceInUsd; - tvl += slpTVL; -*/ - //Get total amount of CLP staked in staking contract - const stakedCLPPool = await getBalInFloat(alUSDCurveLPContract, stakingPool); - const stakedCLPGauge = await getBalInFloat( - alUSDCurveLPContract, - curveStakingPool - ); - const stakedCLP = stakedCLPPool + stakedCLPGauge; - - let virtualPrice; - try { - virtualPrice = await getVirtualPriceFloat(alUSDCurveLPContract); - } catch (err) { - virtualPrice = 1; - console.error(err); - } - let curveTVL = stakedCLP * virtualPrice; - tvl += curveTVL; - - // get total amount of alETH LP staked in staking contracts - const stakedALETHLP = await getBalInFloat(alETHSaddleLPContract, stakingPool); - tvl += stakedALETHLP * ethPriceInUsd; - // Get total amount of alUSD staked in staking contract - const stakedAlUSD = await getBalInFloat(alusdcontract, stakingPool); - tvl += stakedAlUSD; - - return tvl; -} -async function fetch() { - let tvl = await dai(0) - const ethPriceInUsd = await getTokenPriceCoinGecko("usd")("ethereum"); - tvl += (await eth()) * ethPriceInUsd - tvl += (await alcx()) - return lp(tvl, ethPriceInUsd) -} - -module.exports = { - fetch, - eth -}; -// node test.js projects/alchemix.js \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/ankr/abis/AethToken.json b/src/adapters/peggedAssets/llama-helper/ankr/abis/AethToken.json deleted file mode 100644 index cd3ac401..00000000 --- a/src/adapters/peggedAssets/llama-helper/ankr/abis/AethToken.json +++ /dev/null @@ -1,293 +0,0 @@ -[ - { - "constant": true, - "inputs": [], - "name": "name", - "outputs": [ - { - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "guy", - "type": "address" - }, - { - "name": "wad", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "src", - "type": "address" - }, - { - "name": "dst", - "type": "address" - }, - { - "name": "wad", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "wad", - "type": "uint256" - } - ], - "name": "withdraw", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "decimals", - "outputs": [ - { - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "symbol", - "outputs": [ - { - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "name": "dst", - "type": "address" - }, - { - "name": "wad", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "deposit", - "outputs": [], - "payable": true, - "stateMutability": "payable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "name": "", - "type": "address" - }, - { - "name": "", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "payable": true, - "stateMutability": "payable", - "type": "fallback" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "src", - "type": "address" - }, - { - "indexed": true, - "name": "guy", - "type": "address" - }, - { - "indexed": false, - "name": "wad", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "src", - "type": "address" - }, - { - "indexed": true, - "name": "dst", - "type": "address" - }, - { - "indexed": false, - "name": "wad", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "dst", - "type": "address" - }, - { - "indexed": false, - "name": "wad", - "type": "uint256" - } - ], - "name": "Deposit", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "name": "src", - "type": "address" - }, - { - "indexed": false, - "name": "wad", - "type": "uint256" - } - ], - "name": "Withdrawal", - "type": "event" - }, - { - "inputs": [], - "name": "ratio", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - } -] - diff --git a/src/adapters/peggedAssets/llama-helper/ankr/abis/ERC20.json b/src/adapters/peggedAssets/llama-helper/ankr/abis/ERC20.json deleted file mode 100644 index be242206..00000000 --- a/src/adapters/peggedAssets/llama-helper/ankr/abis/ERC20.json +++ /dev/null @@ -1,347 +0,0 @@ -[ - { - "inputs": [], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "subtractedValue", - "type": "uint256" - } - ], - "name": "decreaseAllowance", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "addedValue", - "type": "uint256" - } - ], - "name": "increaseAllowance", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "mintTo", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } -] \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/ankr/abis/OnsToken.json b/src/adapters/peggedAssets/llama-helper/ankr/abis/OnsToken.json deleted file mode 100644 index bc849fc7..00000000 --- a/src/adapters/peggedAssets/llama-helper/ankr/abis/OnsToken.json +++ /dev/null @@ -1,602 +0,0 @@ -[ - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousGovernor", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newGovernor", - "type": "address" - } - ], - "name": "GovernorshipTransferred", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "governor_", - "type": "address" - } - ], - "name": "__Governable_init_unchained", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "governor_", - "type": "address" - }, - { - "internalType": "address", - "name": "vault_", - "type": "address" - }, - { - "internalType": "address", - "name": "onsFarm", - "type": "address" - }, - { - "internalType": "address", - "name": "offering", - "type": "address" - }, - { - "internalType": "address", - "name": "timelock", - "type": "address" - } - ], - "name": "__ONS_init", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "onsFarm", - "type": "address" - }, - { - "internalType": "address", - "name": "offering", - "type": "address" - }, - { - "internalType": "address", - "name": "timelock", - "type": "address" - } - ], - "name": "__ONS_init_unchained", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "vault_", - "type": "address" - } - ], - "name": "__VaultERC20_init_unchained", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "acct", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amt", - "type": "uint256" - } - ], - "name": "burn_", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "subtractedValue", - "type": "uint256" - } - ], - "name": "decreaseAllowance", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "addr", - "type": "address" - } - ], - "name": "getConfig", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "getConfig", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "getConfig", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "governor", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "addedValue", - "type": "uint256" - } - ], - "name": "increaseAllowance", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "acct", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amt", - "type": "uint256" - } - ], - "name": "mint_", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "renounceGovernorship", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "setConfig", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "addr", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "setConfig", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "setConfig", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transferFrom_", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newGovernor", - "type": "address" - } - ], - "name": "transferGovernorship", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } -] \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/ankr/abis/OnxPool.json b/src/adapters/peggedAssets/llama-helper/ankr/abis/OnxPool.json deleted file mode 100644 index ba04bb37..00000000 --- a/src/adapters/peggedAssets/llama-helper/ankr/abis/OnxPool.json +++ /dev/null @@ -1,1402 +0,0 @@ -[ - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_user", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_supplyAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_collateralAmount", - "type": "uint256" - } - ], - "name": "Borrow", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "oldValue", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newValue", - "type": "uint256" - } - ], - "name": "BorrowPowerChange", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "user", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "BorrowerProductivityDecreased", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "user", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "BorrowerProductivityIncreased", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_user", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_collateralAmount", - "type": "uint256" - } - ], - "name": "Deposit", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "oldValue", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "newValue", - "type": "uint256" - } - ], - "name": "InterestRatePerBlockChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "user", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "LenderProductivityDecreased", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "user", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "LenderProductivityIncreased", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_liquidator", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_user", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_supplyAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_collateralAmount", - "type": "uint256" - } - ], - "name": "Liquidation", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "user", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "userAmount", - "type": "uint256" - } - ], - "name": "MintBorrower", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "user", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "userAmount", - "type": "uint256" - } - ], - "name": "MintLender", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_oldOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_newOwner", - "type": "address" - } - ], - "name": "OwnerChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_user", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_reinvestAmount", - "type": "uint256" - } - ], - "name": "Reinvest", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_user", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_supplyAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_collateralAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_interestAmount", - "type": "uint256" - } - ], - "name": "Repay", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_user", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_supplyAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_collateralAmount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_interestAmount", - "type": "uint256" - } - ], - "name": "Withdraw", - "type": "event" - }, - { - "inputs": [], - "name": "accAmountPerBorrow", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "accAmountPerLend", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amountCollateral", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "repayAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "expectBorrow", - "type": "uint256" - }, - { - "internalType": "address", - "name": "from", - "type": "address" - } - ], - "name": "borrow", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "borrowerList", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "borrowers", - "outputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "rewardDebt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "rewardEarn", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "user", - "type": "address" - } - ], - "name": "borrows", - "outputs": [ - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amountCollateral", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "interestSettled", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amountBorrow", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "interests", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "collateralStrategy", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "collateralToken", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "config", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amountDeposit", - "type": "uint256" - }, - { - "internalType": "address", - "name": "from", - "type": "address" - } - ], - "name": "deposit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "factory", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "user", - "type": "address" - } - ], - "name": "getBorrowerProductivity", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "internalType": "address", - "name": "addr", - "type": "address" - } - ], - "name": "getConfig", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - } - ], - "name": "getConfig", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "key", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "getConfig", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getInterests", - "outputs": [ - { - "internalType": "uint256", - "name": "supplyInterestPerBlock", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "borrowInterestPerBlock", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "user", - "type": "address" - } - ], - "name": "getLenderProductivity", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getPoolCapacity", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_supplyToken", - "type": "address" - }, - { - "internalType": "address", - "name": "_collateralToken", - "type": "address" - } - ], - "name": "init", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_factory", - "type": "address" - } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "interestPerBorrow", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "interestPerSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "interestsPerBlock", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "lastInterestUpdate", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "lenders", - "outputs": [ - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "rewardDebt", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "rewardEarn", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_user", - "type": "address" - }, - { - "internalType": "address", - "name": "from", - "type": "address" - } - ], - "name": "liquidation", - "outputs": [ - { - "internalType": "uint256", - "name": "borrowAmount", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "user", - "type": "address" - }, - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "liquidationHistory", - "outputs": [ - { - "internalType": "uint256", - "name": "amountCollateral", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidationAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "timestamp", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "liquidationHistoryLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "liquidationPerSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "mint", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "mintCumulation", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "mintedShare", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "numberBorrowers", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "payoutRatio", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - } - ], - "name": "reinvest", - "outputs": [ - { - "internalType": "uint256", - "name": "reinvestAmount", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "remainSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amountCollateral", - "type": "uint256" - }, - { - "internalType": "address", - "name": "from", - "type": "address" - } - ], - "name": "repay", - "outputs": [ - { - "internalType": "uint256", - "name": "repayAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "payoutInterest", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_collateralStrategy", - "type": "address" - }, - { - "internalType": "address", - "name": "_supplyStrategy", - "type": "address" - } - ], - "name": "setCollateralStrategy", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_config", - "type": "address" - } - ], - "name": "setupConfig", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "supplyStrategy", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "supplyToken", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "user", - "type": "address" - } - ], - "name": "supplys", - "outputs": [ - { - "internalType": "uint256", - "name": "amountSupply", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "interestSettled", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "liquidationSettled", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "interests", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_liquidation", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "takeAll", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "takeAllWithBlock", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "user", - "type": "address" - } - ], - "name": "takeBorrowWithAddress", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "takeBorrowWithBlock", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "user", - "type": "address" - } - ], - "name": "takeLendWithAddress", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "takeLendWithBlock", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalBorrow", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalBorrowProducitivity", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalBorrowSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalLendProductivity", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalLendSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalLiquidation", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalLiquidationSupplyAmount", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalPledge", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalShare", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalStake", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "amountWithdraw", - "type": "uint256" - }, - { - "internalType": "address", - "name": "from", - "type": "address" - } - ], - "name": "withdraw", - "outputs": [ - { - "internalType": "uint256", - "name": "withdrawSupplyAmount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "withdrawLiquidation", - "type": "uint256" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } -] \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/ankr/abis/OnxToken.json b/src/adapters/peggedAssets/llama-helper/ankr/abis/OnxToken.json deleted file mode 100644 index 23f1cac0..00000000 --- a/src/adapters/peggedAssets/llama-helper/ankr/abis/OnxToken.json +++ /dev/null @@ -1,384 +0,0 @@ -[ - { - "inputs": [ - { - "internalType": "address", - "name": "_exchange", - "type": "address" - }, - { - "internalType": "address", - "name": "_treasury", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "subtractedValue", - "type": "uint256" - } - ], - "name": "decreaseAllowance", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "exchangeAirdropCampaign", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "addedValue", - "type": "uint256" - } - ], - "name": "increaseAllowance", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "mintTo", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "treasuryAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } -] \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/ankr/abis/QuickswapPool.json b/src/adapters/peggedAssets/llama-helper/ankr/abis/QuickswapPool.json deleted file mode 100644 index 809791ba..00000000 --- a/src/adapters/peggedAssets/llama-helper/ankr/abis/QuickswapPool.json +++ /dev/null @@ -1,345 +0,0 @@ -[ - { "inputs": [], "payable": false, "stateMutability": "nonpayable", "type": "constructor" }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount0", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "amount1", "type": "uint256" }, - { "indexed": true, "internalType": "address", "name": "to", "type": "address" } - ], - "name": "Burn", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount0", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "amount1", "type": "uint256" } - ], - "name": "Mint", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount0In", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "amount1In", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "amount0Out", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "amount1Out", "type": "uint256" }, - { "indexed": true, "internalType": "address", "name": "to", "type": "address" } - ], - "name": "Swap", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "uint112", "name": "reserve0", "type": "uint112" }, - { "indexed": false, "internalType": "uint112", "name": "reserve1", "type": "uint112" } - ], - "name": "Sync", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "Transfer", - "type": "event" - }, - { - "constant": true, - "inputs": [], - "name": "DOMAIN_SEPARATOR", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "MINIMUM_LIQUIDITY", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "PERMIT_TYPEHASH", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { "internalType": "address", "name": "", "type": "address" }, - { "internalType": "address", "name": "", "type": "address" } - ], - "name": "allowance", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "approve", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [{ "internalType": "address", "name": "", "type": "address" }], - "name": "balanceOf", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], - "name": "burn", - "outputs": [ - { "internalType": "uint256", "name": "amount0", "type": "uint256" }, - { "internalType": "uint256", "name": "amount1", "type": "uint256" } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "decimals", - "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "factory", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getReserves", - "outputs": [ - { "internalType": "uint112", "name": "_reserve0", "type": "uint112" }, - { "internalType": "uint112", "name": "_reserve1", "type": "uint112" }, - { "internalType": "uint32", "name": "_blockTimestampLast", "type": "uint32" } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "internalType": "address", "name": "_token0", "type": "address" }, - { "internalType": "address", "name": "_token1", "type": "address" } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "kLast", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], - "name": "mint", - "outputs": [{ "internalType": "uint256", "name": "liquidity", "type": "uint256" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "name", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [{ "internalType": "address", "name": "", "type": "address" }], - "name": "nonces", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "internalType": "address", "name": "owner", "type": "address" }, - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" }, - { "internalType": "uint8", "name": "v", "type": "uint8" }, - { "internalType": "bytes32", "name": "r", "type": "bytes32" }, - { "internalType": "bytes32", "name": "s", "type": "bytes32" } - ], - "name": "permit", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "price0CumulativeLast", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "price1CumulativeLast", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], - "name": "skim", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "internalType": "uint256", "name": "amount0Out", "type": "uint256" }, - { "internalType": "uint256", "name": "amount1Out", "type": "uint256" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } - ], - "name": "swap", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "symbol", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "sync", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "token0", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "token1", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "totalSupply", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "transfer", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { "internalType": "address", "name": "from", "type": "address" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "transferFrom", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - } -] diff --git a/src/adapters/peggedAssets/llama-helper/ankr/abis/QuickswapVault.json b/src/adapters/peggedAssets/llama-helper/ankr/abis/QuickswapVault.json deleted file mode 100644 index faec382e..00000000 --- a/src/adapters/peggedAssets/llama-helper/ankr/abis/QuickswapVault.json +++ /dev/null @@ -1,292 +0,0 @@ -[ - { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "beneficiary", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "Deposit", - "type": "event" - }, - { - "anonymous": false, - "inputs": [{ "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" }], - "name": "Invest", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "beneficiary", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "Withdraw", - "type": "event" - }, - { - "inputs": [ - { "internalType": "address", "name": "owner", "type": "address" }, - { "internalType": "address", "name": "spender", "type": "address" } - ], - "name": "allowance", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "approve", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], - "name": "balanceOf", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "controller", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "subtractedValue", "type": "uint256" } - ], - "name": "decreaseAllowance", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "uint256", "name": "amount", "type": "uint256" }], - "name": "deposit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "amount", "type": "uint256" }, - { "internalType": "address", "name": "holder", "type": "address" } - ], - "name": "depositFor", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { "inputs": [], "name": "doHardWork", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [], - "name": "governance", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "addedValue", "type": "uint256" } - ], - "name": "increaseAllowance", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "_storage", "type": "address" }, - { "internalType": "address", "name": "_underlying", "type": "address" } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "_storage", "type": "address" }], - "name": "initializeControllableInit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "_store", "type": "address" }], - "name": "initializeGovernableInit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "_underlying", "type": "address" }, - { "internalType": "uint256", "name": "_underlyingUnit", "type": "uint256" } - ], - "name": "initializeVaultStorage", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "stateMutability": "view", - "type": "function" - }, - { "inputs": [], "name": "rebalance", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [ - { "internalType": "uint256", "name": "_fee", "type": "uint256" }, - { "internalType": "uint256", "name": "_feeMax", "type": "uint256" } - ], - "name": "setKeepFee", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "_store", "type": "address" }], - "name": "setStorage", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "_strategy", "type": "address" }], - "name": "setStrategy", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { "inputs": [], "name": "stakeQuickFarm", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [], - "name": "strategy", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "recipient", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "transfer", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "sender", "type": "address" }, - { "internalType": "address", "name": "recipient", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "transferFrom", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "treasury", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "underlying", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "underlyingBalanceInVault", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "underlyingBalanceWithInvestment", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "holder", "type": "address" }], - "name": "underlyingBalanceWithInvestmentForHolder", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "underlyingUnit", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "uint256", "name": "numberOfShares", "type": "uint256" }], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { "inputs": [], "name": "withdrawAll", "outputs": [], "stateMutability": "nonpayable", "type": "function" } -] diff --git a/src/adapters/peggedAssets/llama-helper/ankr/abis/SOnxToken.json b/src/adapters/peggedAssets/llama-helper/ankr/abis/SOnxToken.json deleted file mode 100644 index 2b6c6a3b..00000000 --- a/src/adapters/peggedAssets/llama-helper/ankr/abis/SOnxToken.json +++ /dev/null @@ -1,322 +0,0 @@ -[ - { - "inputs": [ - { - "internalType": "contract IERC20", - "name": "_onx", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "subtractedValue", - "type": "uint256" - } - ], - "name": "decreaseAllowance", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "enter", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "addedValue", - "type": "uint256" - } - ], - "name": "increaseAllowance", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_share", - "type": "uint256" - } - ], - "name": "leave", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "onx", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } -] \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/ankr/abis/SpookyswapPool.json b/src/adapters/peggedAssets/llama-helper/ankr/abis/SpookyswapPool.json deleted file mode 100644 index 13494279..00000000 --- a/src/adapters/peggedAssets/llama-helper/ankr/abis/SpookyswapPool.json +++ /dev/null @@ -1,285 +0,0 @@ -[ - { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount0", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "amount1", "type": "uint256" }, - { "indexed": true, "internalType": "address", "name": "to", "type": "address" } - ], - "name": "Burn", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount0", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "amount1", "type": "uint256" } - ], - "name": "Mint", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount0In", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "amount1In", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "amount0Out", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "amount1Out", "type": "uint256" }, - { "indexed": true, "internalType": "address", "name": "to", "type": "address" } - ], - "name": "Swap", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "uint112", "name": "reserve0", "type": "uint112" }, - { "indexed": false, "internalType": "uint112", "name": "reserve1", "type": "uint112" } - ], - "name": "Sync", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "Transfer", - "type": "event" - }, - { - "inputs": [], - "name": "DOMAIN_SEPARATOR", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MINIMUM_LIQUIDITY", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PERMIT_TYPEHASH", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "", "type": "address" }, - { "internalType": "address", "name": "", "type": "address" } - ], - "name": "allowance", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "approve", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "", "type": "address" }], - "name": "balanceOf", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], - "name": "burn", - "outputs": [ - { "internalType": "uint256", "name": "amount0", "type": "uint256" }, - { "internalType": "uint256", "name": "amount1", "type": "uint256" } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "factory", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getReserves", - "outputs": [ - { "internalType": "uint112", "name": "_reserve0", "type": "uint112" }, - { "internalType": "uint112", "name": "_reserve1", "type": "uint112" }, - { "internalType": "uint32", "name": "_blockTimestampLast", "type": "uint32" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "_token0", "type": "address" }, - { "internalType": "address", "name": "_token1", "type": "address" } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "kLast", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], - "name": "mint", - "outputs": [{ "internalType": "uint256", "name": "liquidity", "type": "uint256" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "", "type": "address" }], - "name": "nonces", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "owner", "type": "address" }, - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" }, - { "internalType": "uint8", "name": "v", "type": "uint8" }, - { "internalType": "bytes32", "name": "r", "type": "bytes32" }, - { "internalType": "bytes32", "name": "s", "type": "bytes32" } - ], - "name": "permit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "price0CumulativeLast", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "price1CumulativeLast", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], - "name": "skim", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "amount0Out", "type": "uint256" }, - { "internalType": "uint256", "name": "amount1Out", "type": "uint256" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } - ], - "name": "swap", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "stateMutability": "view", - "type": "function" - }, - { "inputs": [], "name": "sync", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [], - "name": "token0", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "token1", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "transfer", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "from", "type": "address" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "transferFrom", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - } -] diff --git a/src/adapters/peggedAssets/llama-helper/ankr/abis/SpookyswapVault.json b/src/adapters/peggedAssets/llama-helper/ankr/abis/SpookyswapVault.json deleted file mode 100644 index b87a3f1d..00000000 --- a/src/adapters/peggedAssets/llama-helper/ankr/abis/SpookyswapVault.json +++ /dev/null @@ -1,277 +0,0 @@ -[ - { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "beneficiary", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "Deposit", - "type": "event" - }, - { - "anonymous": false, - "inputs": [{ "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" }], - "name": "Invest", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "beneficiary", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "Withdraw", - "type": "event" - }, - { - "inputs": [ - { "internalType": "address", "name": "owner", "type": "address" }, - { "internalType": "address", "name": "spender", "type": "address" } - ], - "name": "allowance", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "approve", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], - "name": "balanceOf", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "controller", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "subtractedValue", "type": "uint256" } - ], - "name": "decreaseAllowance", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "uint256", "name": "amount", "type": "uint256" }], - "name": "deposit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "amount", "type": "uint256" }, - { "internalType": "address", "name": "holder", "type": "address" } - ], - "name": "depositFor", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { "inputs": [], "name": "doHardWork", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [], - "name": "governance", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "addedValue", "type": "uint256" } - ], - "name": "increaseAllowance", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "_storage", "type": "address" }, - { "internalType": "address", "name": "_underlying", "type": "address" } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "_storage", "type": "address" }], - "name": "initializeControllableInit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "_store", "type": "address" }], - "name": "initializeGovernableInit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "_underlying", "type": "address" }, - { "internalType": "uint256", "name": "_underlyingUnit", "type": "uint256" } - ], - "name": "initializeVaultStorage", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "stateMutability": "view", - "type": "function" - }, - { "inputs": [], "name": "rebalance", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [{ "internalType": "address", "name": "_store", "type": "address" }], - "name": "setStorage", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "_strategy", "type": "address" }], - "name": "setStrategy", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { "inputs": [], "name": "stakeBooFarm", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { "inputs": [], "name": "stakeExternalRewards", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { "inputs": [], "name": "stakeXBoo", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [], - "name": "strategy", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "recipient", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "transfer", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "sender", "type": "address" }, - { "internalType": "address", "name": "recipient", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "transferFrom", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "underlying", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "underlyingBalanceInVault", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "underlyingBalanceWithInvestment", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "holder", "type": "address" }], - "name": "underlyingBalanceWithInvestmentForHolder", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "underlyingUnit", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "uint256", "name": "numberOfShares", "type": "uint256" }], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { "inputs": [], "name": "withdrawAll", "outputs": [], "stateMutability": "nonpayable", "type": "function" } -] diff --git a/src/adapters/peggedAssets/llama-helper/ankr/abis/SushiswapPool.json b/src/adapters/peggedAssets/llama-helper/ankr/abis/SushiswapPool.json deleted file mode 100644 index 13494279..00000000 --- a/src/adapters/peggedAssets/llama-helper/ankr/abis/SushiswapPool.json +++ /dev/null @@ -1,285 +0,0 @@ -[ - { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount0", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "amount1", "type": "uint256" }, - { "indexed": true, "internalType": "address", "name": "to", "type": "address" } - ], - "name": "Burn", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount0", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "amount1", "type": "uint256" } - ], - "name": "Mint", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount0In", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "amount1In", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "amount0Out", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "amount1Out", "type": "uint256" }, - { "indexed": true, "internalType": "address", "name": "to", "type": "address" } - ], - "name": "Swap", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "uint112", "name": "reserve0", "type": "uint112" }, - { "indexed": false, "internalType": "uint112", "name": "reserve1", "type": "uint112" } - ], - "name": "Sync", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "Transfer", - "type": "event" - }, - { - "inputs": [], - "name": "DOMAIN_SEPARATOR", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MINIMUM_LIQUIDITY", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PERMIT_TYPEHASH", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "", "type": "address" }, - { "internalType": "address", "name": "", "type": "address" } - ], - "name": "allowance", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "approve", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "", "type": "address" }], - "name": "balanceOf", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], - "name": "burn", - "outputs": [ - { "internalType": "uint256", "name": "amount0", "type": "uint256" }, - { "internalType": "uint256", "name": "amount1", "type": "uint256" } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "factory", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getReserves", - "outputs": [ - { "internalType": "uint112", "name": "_reserve0", "type": "uint112" }, - { "internalType": "uint112", "name": "_reserve1", "type": "uint112" }, - { "internalType": "uint32", "name": "_blockTimestampLast", "type": "uint32" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "_token0", "type": "address" }, - { "internalType": "address", "name": "_token1", "type": "address" } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "kLast", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], - "name": "mint", - "outputs": [{ "internalType": "uint256", "name": "liquidity", "type": "uint256" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "", "type": "address" }], - "name": "nonces", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "owner", "type": "address" }, - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" }, - { "internalType": "uint8", "name": "v", "type": "uint8" }, - { "internalType": "bytes32", "name": "r", "type": "bytes32" }, - { "internalType": "bytes32", "name": "s", "type": "bytes32" } - ], - "name": "permit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "price0CumulativeLast", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "price1CumulativeLast", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], - "name": "skim", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "amount0Out", "type": "uint256" }, - { "internalType": "uint256", "name": "amount1Out", "type": "uint256" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } - ], - "name": "swap", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "stateMutability": "view", - "type": "function" - }, - { "inputs": [], "name": "sync", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [], - "name": "token0", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "token1", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "transfer", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "from", "type": "address" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "transferFrom", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - } -] diff --git a/src/adapters/peggedAssets/llama-helper/ankr/abis/SushiswapVault.json b/src/adapters/peggedAssets/llama-helper/ankr/abis/SushiswapVault.json deleted file mode 100644 index 7200fb52..00000000 --- a/src/adapters/peggedAssets/llama-helper/ankr/abis/SushiswapVault.json +++ /dev/null @@ -1,280 +0,0 @@ -[ - { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "beneficiary", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "Deposit", - "type": "event" - }, - { - "anonymous": false, - "inputs": [{ "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" }], - "name": "Invest", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "beneficiary", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "Withdraw", - "type": "event" - }, - { - "inputs": [ - { "internalType": "address", "name": "owner", "type": "address" }, - { "internalType": "address", "name": "spender", "type": "address" } - ], - "name": "allowance", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "approve", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], - "name": "balanceOf", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "controller", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "subtractedValue", "type": "uint256" } - ], - "name": "decreaseAllowance", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "uint256", "name": "amount", "type": "uint256" }], - "name": "deposit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "amount", "type": "uint256" }, - { "internalType": "address", "name": "holder", "type": "address" } - ], - "name": "depositFor", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { "inputs": [], "name": "doHardWork", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { "inputs": [], "name": "doHardWorkSOnx", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { "inputs": [], "name": "doHardWorkXSushi", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [], - "name": "governance", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "addedValue", "type": "uint256" } - ], - "name": "increaseAllowance", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "_storage", "type": "address" }, - { "internalType": "address", "name": "_underlying", "type": "address" } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "_storage", "type": "address" }], - "name": "initializeControllableInit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "_store", "type": "address" }], - "name": "initializeGovernableInit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "_underlying", "type": "address" }, - { "internalType": "uint256", "name": "_underlyingUnit", "type": "uint256" } - ], - "name": "initializeVaultStorage", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "stateMutability": "view", - "type": "function" - }, - { "inputs": [], "name": "rebalance", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [{ "internalType": "address", "name": "_store", "type": "address" }], - "name": "setStorage", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "_strategy", "type": "address" }], - "name": "setStrategy", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { "inputs": [], "name": "stakeOnsenFarm", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { "inputs": [], "name": "stakeOnx", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { "inputs": [], "name": "stakeOnxFarm", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { "inputs": [], "name": "stakeSushiBar", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [], - "name": "strategy", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "recipient", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "transfer", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "sender", "type": "address" }, - { "internalType": "address", "name": "recipient", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "transferFrom", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "underlying", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "underlyingBalanceInVault", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "underlyingBalanceWithInvestment", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "holder", "type": "address" }], - "name": "underlyingBalanceWithInvestmentForHolder", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "underlyingUnit", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "uint256", "name": "numberOfShares", "type": "uint256" }], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { "inputs": [], "name": "withdrawAll", "outputs": [], "stateMutability": "nonpayable", "type": "function" } -] diff --git a/src/adapters/peggedAssets/llama-helper/ankr/abis/TraderJoePool.json b/src/adapters/peggedAssets/llama-helper/ankr/abis/TraderJoePool.json deleted file mode 100644 index 13494279..00000000 --- a/src/adapters/peggedAssets/llama-helper/ankr/abis/TraderJoePool.json +++ /dev/null @@ -1,285 +0,0 @@ -[ - { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount0", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "amount1", "type": "uint256" }, - { "indexed": true, "internalType": "address", "name": "to", "type": "address" } - ], - "name": "Burn", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount0", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "amount1", "type": "uint256" } - ], - "name": "Mint", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "sender", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount0In", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "amount1In", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "amount0Out", "type": "uint256" }, - { "indexed": false, "internalType": "uint256", "name": "amount1Out", "type": "uint256" }, - { "indexed": true, "internalType": "address", "name": "to", "type": "address" } - ], - "name": "Swap", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": false, "internalType": "uint112", "name": "reserve0", "type": "uint112" }, - { "indexed": false, "internalType": "uint112", "name": "reserve1", "type": "uint112" } - ], - "name": "Sync", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "Transfer", - "type": "event" - }, - { - "inputs": [], - "name": "DOMAIN_SEPARATOR", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "MINIMUM_LIQUIDITY", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "PERMIT_TYPEHASH", - "outputs": [{ "internalType": "bytes32", "name": "", "type": "bytes32" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "", "type": "address" }, - { "internalType": "address", "name": "", "type": "address" } - ], - "name": "allowance", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "approve", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "", "type": "address" }], - "name": "balanceOf", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], - "name": "burn", - "outputs": [ - { "internalType": "uint256", "name": "amount0", "type": "uint256" }, - { "internalType": "uint256", "name": "amount1", "type": "uint256" } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "factory", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getReserves", - "outputs": [ - { "internalType": "uint112", "name": "_reserve0", "type": "uint112" }, - { "internalType": "uint112", "name": "_reserve1", "type": "uint112" }, - { "internalType": "uint32", "name": "_blockTimestampLast", "type": "uint32" } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "_token0", "type": "address" }, - { "internalType": "address", "name": "_token1", "type": "address" } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "kLast", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], - "name": "mint", - "outputs": [{ "internalType": "uint256", "name": "liquidity", "type": "uint256" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "", "type": "address" }], - "name": "nonces", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "owner", "type": "address" }, - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" }, - { "internalType": "uint256", "name": "deadline", "type": "uint256" }, - { "internalType": "uint8", "name": "v", "type": "uint8" }, - { "internalType": "bytes32", "name": "r", "type": "bytes32" }, - { "internalType": "bytes32", "name": "s", "type": "bytes32" } - ], - "name": "permit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "price0CumulativeLast", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "price1CumulativeLast", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "to", "type": "address" }], - "name": "skim", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "amount0Out", "type": "uint256" }, - { "internalType": "uint256", "name": "amount1Out", "type": "uint256" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "bytes", "name": "data", "type": "bytes" } - ], - "name": "swap", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "stateMutability": "view", - "type": "function" - }, - { "inputs": [], "name": "sync", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [], - "name": "token0", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "token1", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "transfer", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "from", "type": "address" }, - { "internalType": "address", "name": "to", "type": "address" }, - { "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "transferFrom", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - } -] diff --git a/src/adapters/peggedAssets/llama-helper/ankr/abis/TraderJoeVault.json b/src/adapters/peggedAssets/llama-helper/ankr/abis/TraderJoeVault.json deleted file mode 100644 index 51b7412f..00000000 --- a/src/adapters/peggedAssets/llama-helper/ankr/abis/TraderJoeVault.json +++ /dev/null @@ -1,284 +0,0 @@ -[ - { "inputs": [], "stateMutability": "nonpayable", "type": "constructor" }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "owner", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "spender", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "beneficiary", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "Deposit", - "type": "event" - }, - { - "anonymous": false, - "inputs": [{ "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" }], - "name": "Invest", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "from", "type": "address" }, - { "indexed": true, "internalType": "address", "name": "to", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "value", "type": "uint256" } - ], - "name": "Transfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { "indexed": true, "internalType": "address", "name": "beneficiary", "type": "address" }, - { "indexed": false, "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "Withdraw", - "type": "event" - }, - { - "inputs": [ - { "internalType": "address", "name": "owner", "type": "address" }, - { "internalType": "address", "name": "spender", "type": "address" } - ], - "name": "allowance", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "approve", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], - "name": "balanceOf", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "controller", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [{ "internalType": "uint8", "name": "", "type": "uint8" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "subtractedValue", "type": "uint256" } - ], - "name": "decreaseAllowance", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "uint256", "name": "amount", "type": "uint256" }], - "name": "deposit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "uint256", "name": "amount", "type": "uint256" }, - { "internalType": "address", "name": "holder", "type": "address" } - ], - "name": "depositFor", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { "inputs": [], "name": "doHardWork", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [], - "name": "governance", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "spender", "type": "address" }, - { "internalType": "uint256", "name": "addedValue", "type": "uint256" } - ], - "name": "increaseAllowance", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "_storage", "type": "address" }, - { "internalType": "address", "name": "_underlying", "type": "address" } - ], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "_storage", "type": "address" }], - "name": "initializeControllableInit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "_store", "type": "address" }], - "name": "initializeGovernableInit", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "_underlying", "type": "address" }, - { "internalType": "uint256", "name": "_underlyingUnit", "type": "uint256" } - ], - "name": "initializeVaultStorage", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "stateMutability": "view", - "type": "function" - }, - { "inputs": [], "name": "rebalance", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, - { - "inputs": [ - { "internalType": "uint256", "name": "_fee", "type": "uint256" }, - { "internalType": "uint256", "name": "_feeMax", "type": "uint256" } - ], - "name": "setKeepFee", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "_store", "type": "address" }], - "name": "setStorage", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "_strategy", "type": "address" }], - "name": "setStrategy", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "strategy", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [{ "internalType": "string", "name": "", "type": "string" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "recipient", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "transfer", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { "internalType": "address", "name": "sender", "type": "address" }, - { "internalType": "address", "name": "recipient", "type": "address" }, - { "internalType": "uint256", "name": "amount", "type": "uint256" } - ], - "name": "transferFrom", - "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "underlying", - "outputs": [{ "internalType": "address", "name": "", "type": "address" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "underlyingBalanceInVault", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "underlyingBalanceWithInvestment", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "address", "name": "holder", "type": "address" }], - "name": "underlyingBalanceWithInvestmentForHolder", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "underlyingUnit", - "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [{ "internalType": "uint256", "name": "numberOfShares", "type": "uint256" }], - "name": "withdraw", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { "inputs": [], "name": "withdrawAll", "outputs": [], "stateMutability": "nonpayable", "type": "function" } -] diff --git a/src/adapters/peggedAssets/llama-helper/ankr/abis/UniswapV2Pair.json b/src/adapters/peggedAssets/llama-helper/ankr/abis/UniswapV2Pair.json deleted file mode 100644 index 53582c1e..00000000 --- a/src/adapters/peggedAssets/llama-helper/ankr/abis/UniswapV2Pair.json +++ /dev/null @@ -1,713 +0,0 @@ -[ - { - "inputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount0", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount1", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - } - ], - "name": "Burn", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount0", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount1", - "type": "uint256" - } - ], - "name": "Mint", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount0In", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount1In", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount0Out", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "amount1Out", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - } - ], - "name": "Swap", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint112", - "name": "reserve0", - "type": "uint112" - }, - { - "indexed": false, - "internalType": "uint112", - "name": "reserve1", - "type": "uint112" - } - ], - "name": "Sync", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "constant": true, - "inputs": [], - "name": "DOMAIN_SEPARATOR", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "MINIMUM_LIQUIDITY", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "PERMIT_TYPEHASH", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - }, - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - } - ], - "name": "burn", - "outputs": [ - { - "internalType": "uint256", - "name": "amount0", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount1", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "decimals", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "factory", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "getReserves", - "outputs": [ - { - "internalType": "uint112", - "name": "_reserve0", - "type": "uint112" - }, - { - "internalType": "uint112", - "name": "_reserve1", - "type": "uint112" - }, - { - "internalType": "uint32", - "name": "_blockTimestampLast", - "type": "uint32" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "_token0", - "type": "address" - }, - { - "internalType": "address", - "name": "_token1", - "type": "address" - } - ], - "name": "initialize", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "kLast", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - } - ], - "name": "mint", - "outputs": [ - { - "internalType": "uint256", - "name": "liquidity", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "nonces", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "deadline", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "v", - "type": "uint8" - }, - { - "internalType": "bytes32", - "name": "r", - "type": "bytes32" - }, - { - "internalType": "bytes32", - "name": "s", - "type": "bytes32" - } - ], - "name": "permit", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "price0CumulativeLast", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "price1CumulativeLast", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - } - ], - "name": "skim", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "uint256", - "name": "amount0Out", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "amount1Out", - "type": "uint256" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "swap", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [], - "name": "sync", - "outputs": [], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "token0", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "token1", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": true, - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "payable": false, - "stateMutability": "view", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - }, - { - "constant": false, - "inputs": [ - { - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "payable": false, - "stateMutability": "nonpayable", - "type": "function" - } -] diff --git a/src/adapters/peggedAssets/llama-helper/ankr/abis/activePool.json b/src/adapters/peggedAssets/llama-helper/ankr/abis/activePool.json deleted file mode 100644 index 5a4554fe..00000000 --- a/src/adapters/peggedAssets/llama-helper/ankr/abis/activePool.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "inputs": [], - "name": "activePool", - "outputs": [ - { - "internalType": "contract IActivePool", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" -} \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/ankr/abis/wethAddress.json b/src/adapters/peggedAssets/llama-helper/ankr/abis/wethAddress.json deleted file mode 100644 index e58bb9cd..00000000 --- a/src/adapters/peggedAssets/llama-helper/ankr/abis/wethAddress.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "inputs": [], - "name": "wethAddress", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" -} \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/ankr/chainAddresses.js b/src/adapters/peggedAssets/llama-helper/ankr/chainAddresses.js deleted file mode 100644 index 60cc8a83..00000000 --- a/src/adapters/peggedAssets/llama-helper/ankr/chainAddresses.js +++ /dev/null @@ -1,9 +0,0 @@ -const coinAddresses = { - weth: "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", //Ethereum - ftm: "0x4e15361fd6b4bb609fa63c81a2be19d873717870", //Fantom - matic: "0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0", //Matic - dot: "0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0", //DOT - avax: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee", //Avalanche -}; - -module.exports = coinAddresses; \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/ankr/networks.js b/src/adapters/peggedAssets/llama-helper/ankr/networks.js deleted file mode 100644 index 8545c7ac..00000000 --- a/src/adapters/peggedAssets/llama-helper/ankr/networks.js +++ /dev/null @@ -1,84 +0,0 @@ -const SupportedChainId = { - MAINNET: 1, - ROPSTEN: 3, - MATIC: 137, - MATIC_TESTNET: 80001, - LOCAL_TESTNET: 31337, - BSC: 56, - FANTOM: 250, - AVALANCHE: 0xa86a, -} - -const SUPPORTED_NETWORKS = { - [SupportedChainId.MAINNET]: { - chainId: '0x1', //1 - chainName: 'Ethereum', - nativeCurrency: { - name: 'Ethereum', - symbol: 'ETH', - decimals: 18, - }, - rpcUrls: ['https://mainnet.infura.io/v3'], - blockExplorerUrls: ['https://etherscan.com'], - }, - [SupportedChainId.BSC]: { - chainId: '0x38', //56 - chainName: 'Binance Smart Chain', - nativeCurrency: { - name: 'Binance Coin', - symbol: 'BNB', - decimals: 18, - }, - rpcUrls: ['https://bsc-dataseed.binance.org'], - blockExplorerUrls: ['https://bscscan.com'], - }, - [SupportedChainId.MATIC]: { - chainId: '0x89', //137 - chainName: 'Matic', - nativeCurrency: { - name: 'Matic', - symbol: 'MATIC', - decimals: 18, - }, - rpcUrls: ['https://polygon-rpc.com'], - blockExplorerUrls: ['https://explorer-mainnet.maticvigil.com'], - }, - [SupportedChainId.FANTOM]: { - chainId: '0xFA', //250 - chainName: 'Fantom', - nativeCurrency: { - name: 'FTM', - symbol: 'FTM', - decimals: 18, - }, - rpcUrls: ['https://rpc.ftm.tools/'], - blockExplorerUrls: ['https://ftmscan.com/'], - }, - [SupportedChainId.AVALANCHE]: { - chainId: '0xa86a', //43114 - chainName: 'Avalanche', - nativeCurrency: { - name: 'AVAX', - symbol: 'AVAX', - decimals: 18, - }, - rpcUrls: ['https://api.avax.network/ext/bc/C/rpc'], - blockExplorerUrls: ['https://avascan.info/blockchain/c/'], - }, -}; - -const ethereumRpcUrl = SUPPORTED_NETWORKS[SupportedChainId.MAINNET].rpcUrls[0]; -const fantomRpcUrl = SUPPORTED_NETWORKS[SupportedChainId.FANTOM].rpcUrls[0]; -const polygonRpcUrl = SUPPORTED_NETWORKS[SupportedChainId.MATIC].rpcUrls[0]; -const avalancheRpcUrl = SUPPORTED_NETWORKS[SupportedChainId.AVALANCHE].rpcUrls[0]; -const binanceRpcUrl = SUPPORTED_NETWORKS[SupportedChainId.BSC].rpcUrls[0]; - -module.exports = { - SupportedChainId, - SUPPORTED_NETWORKS, - ethereumRpcUrl, - fantomRpcUrl, - polygonRpcUrl, - avalancheRpcUrl, - binanceRpcUrl, -} \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/ankr/prices/binance.js b/src/adapters/peggedAssets/llama-helper/ankr/prices/binance.js deleted file mode 100644 index e699c675..00000000 --- a/src/adapters/peggedAssets/llama-helper/ankr/prices/binance.js +++ /dev/null @@ -1,12 +0,0 @@ -const { fetchURL } = require("../../utils"); - -const getBinancePrice = async (symbol) => { - const response = await fetchURL( - `https://api.binance.com/api/v3/ticker/price?symbol=${symbol}` - ); - return response?.data?.price; -}; - -module.exports = { - getBinancePrice, -}; diff --git a/src/adapters/peggedAssets/llama-helper/ankr/utils.js b/src/adapters/peggedAssets/llama-helper/ankr/utils.js deleted file mode 100644 index 016af4fe..00000000 --- a/src/adapters/peggedAssets/llama-helper/ankr/utils.js +++ /dev/null @@ -1,79 +0,0 @@ -const BigNumber = require('bignumber.js'); -const { toUSDTBalances } = require('../balances'); -const vaultABI = require('./abis/TraderJoeVault.json'); -const sdk = require("@defillama/sdk") -const UniswapV2PairContractAbi = require('./abis/UniswapV2Pair.json'); - -const ZERO = new BigNumber(0); - -const ONE_COIN = 1e18; - -const fromWei = (v) => { - if (v) { - return new BigNumber(v).div(1e18); - } - return new BigNumber(0); -}; - -const getVautsTvl = async (vaults, getPrice) => { - const vaultsMap = await Promise.all(vaults.map((item) => { - return new Promise(async (resolve) => { - const { vault, chain } = item - let { output: underlyingBalanceWithInvestment } = await sdk.api.abi.call({ - chain, - target: vault, - abi: vaultABI.find(i => i.name === 'underlyingBalanceWithInvestment') - }) - - underlyingBalanceWithInvestment = new BigNumber(underlyingBalanceWithInvestment); - - const usd = await getPrice(item); - - resolve(usd.multipliedBy(underlyingBalanceWithInvestment)); - }) - })); - return toUSDTBalances(vaultsMap.reduce((acc, item) => acc.plus(item), new BigNumber(ZERO))); -} - -function numberWithCommas(x) { - return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ','); -} - -const formatDecimal = (value, decimal = 18, numPoint = 4, precision = 2) => { - const data = new BigNumber(value).dividedBy(new BigNumber(10).pow(decimal)); - if (data.isGreaterThan(1)) { - return numberWithCommas(data.dp(precision, 1).toNumber()); - } - return data.dp(numPoint, 1).toNumber(); -}; - -const getReserves = async (pairAddress) => { - const { output: { _reserve0, _reserve1, _blockTimestampLast } } = await sdk.api.abi.call({ - target: pairAddress, - abi: UniswapV2PairContractAbi.find(i => i.name === 'getReserves') - }) - return { reserve0: _reserve0, reserve1: _reserve1, blockTimestampLast: _blockTimestampLast }; -}; - - -const getTotalSupplyOf = async (contract, chain) => { - const { output: totalSupply } = await sdk.api.erc20.totalSupply({ target: contract }) - return new BigNumber(totalSupply); -}; - -const getBalanceOf = async (account, contract) => { - const { output } = await sdk.api.erc20.balanceOf({ target: contract, owner: account, }) - return new BigNumber(output); -}; - -module.exports = { - ZERO, - ONE_COIN, - fromWei, - getVautsTvl, - formatDecimal, - numberWithCommas, - getReserves, - getTotalSupplyOf, - getBalanceOf, -} \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/aptos.js b/src/adapters/peggedAssets/llama-helper/aptos.js deleted file mode 100644 index 48e4611b..00000000 --- a/src/adapters/peggedAssets/llama-helper/aptos.js +++ /dev/null @@ -1,14 +0,0 @@ -const axios = require("axios"); - -const endpoint = 'https://aptos-mainnet.pontem.network'; - -async function getTokenSupply(token) { - const { data } = await axios.get(`${endpoint}/v1/accounts/${token}/resources`); - const coinInfo = data.find((coin) => coin.type.startsWith('0x1::coin::CoinInfo')); - - return coinInfo.data.supply.vec[0].integer.vec[0].value / 10 ** coinInfo.data.decimals; -} - -module.exports = { - getTokenSupply, -}; diff --git a/src/adapters/peggedAssets/llama-helper/arth.js b/src/adapters/peggedAssets/llama-helper/arth.js deleted file mode 100644 index 561f07da..00000000 --- a/src/adapters/peggedAssets/llama-helper/arth.js +++ /dev/null @@ -1,47 +0,0 @@ -const sdk = require("@defillama/sdk"); -const getEntireSystemCollAbi = require("./abis/getEntireSystemColl.abi.json"); -const { default: BigNumber } = require('bignumber.js'); - -function getArthTvl(TROVE_ADDRESSES, COLLATERAL_ADDRESSES, chain, coingeckoIds = [], decimals = [], symbols = []) { - return async (_, ethBlock, chainBlocks) => { - const block = chainBlocks[chain]; - - // const stabilityPoolLusdTvl = ( - // await sdk.api.erc20.balanceOf({ - // target: ARTH_ADDRESS, - // owner: STABILITY_POOL_ADDRESS, - // block, - // chain, - // }) - // ).output; - - const ret = {}; - const tvls = await Promise.all( - TROVE_ADDRESSES.map(trove => sdk.api.abi.call({ - target: trove, - abi: getEntireSystemCollAbi, - block, - chain, - }) - ) - ); - - - COLLATERAL_ADDRESSES.forEach((collateral, index) => { - let key = chain+':'+collateral; - let val = tvls[index].output; - - if (coingeckoIds[index]) key = coingeckoIds[index]; - - if (ret[key] == undefined) ret[key] = BigNumber(0); - if (decimals[index] !== undefined) val = Number(val) / (10**decimals[index]); - ret[key] = ret[key].plus(BigNumber(val)); - }); - - return ret; - }; -} - -module.exports = { - getArthTvl -}; diff --git a/src/adapters/peggedAssets/llama-helper/balancer.js b/src/adapters/peggedAssets/llama-helper/balancer.js deleted file mode 100644 index 6b1250e6..00000000 --- a/src/adapters/peggedAssets/llama-helper/balancer.js +++ /dev/null @@ -1,32 +0,0 @@ -const { request, gql } = require("graphql-request"); -const { getBlock } = require("../helper/getBlock"); -const { toUSDTBalances } = require("../helper/balances"); - -const graphQuery = gql` -query get_tvl($block: Int) { - balancers( - first: 5, - block: { number: $block } - ) { - totalLiquidity, - } -} -`; - -function getBalancerSubgraphTvl(graphUrl, chain) { - return async (timestamp, ethereumBlock, chainBlocks) => { - const block = await getBlock(timestamp, chain, chainBlocks) - const { balancers } = await request( - graphUrl, - graphQuery, - { - block - } - ); - return toUSDTBalances(balancers[0].totalLiquidity) - } -} - -module.exports = { - getBalancerSubgraphTvl -}; \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/balances.js b/src/adapters/peggedAssets/llama-helper/balances.js deleted file mode 100644 index 3f3b60d0..00000000 --- a/src/adapters/peggedAssets/llama-helper/balances.js +++ /dev/null @@ -1,15 +0,0 @@ -const BigNumber = require("bignumber.js"); - -const usdtAddress = "0xdac17f958d2ee523a2206206994597c13d831ec7"; - -const toUSDT = (value, times = 1e6) => BigNumber(value).times(times).toFixed(0); - -const toUSDTBalances = (value, times = 1e6) => ({ - [usdtAddress]: toUSDT(value, times), -}); - -module.exports = { - toUSDT, - toUSDTBalances, - usdtAddress, -}; diff --git a/src/adapters/peggedAssets/llama-helper/brahmafi-aastra.js b/src/adapters/peggedAssets/llama-helper/brahmafi-aastra.js deleted file mode 100644 index c88b28d9..00000000 --- a/src/adapters/peggedAssets/llama-helper/brahmafi-aastra.js +++ /dev/null @@ -1,18 +0,0 @@ -const sdk = require("@defillama/sdk"); -const abi = require("./abis/brahmafi-aastra.json"); - -const AASTRA = "0xc10d2e42de16719523aaa9277d1b9290aa6c3ad5"; - -const getTotalAmounts = async (block) => { - const totalAmounts = await sdk.api.abi.call({ - target: AASTRA, - abi: abi["getTotalAmounts"], - block: block - }); - - return totalAmounts.output; -}; - -module.exports = { - getTotalAmounts -}; diff --git a/src/adapters/peggedAssets/llama-helper/calculateUniTvl.js b/src/adapters/peggedAssets/llama-helper/calculateUniTvl.js deleted file mode 100644 index 5c00e431..00000000 --- a/src/adapters/peggedAssets/llama-helper/calculateUniTvl.js +++ /dev/null @@ -1,179 +0,0 @@ -const BigNumber = require('bignumber.js'); -const sdk = require('@defillama/sdk'); -const token0 = require('./abis/token0.json'); -const token1 = require('./abis/token1.json'); -const getReserves = require('./abis/getReserves.json'); -const factoryAbi = require('./abis/factory.json'); -const { getBlock } = require('./getBlock') -const { getChainTransform, getFixBalances } = require('./portedTokens') - -async function calculateUniTvl(getAddress, block, chain, FACTORY, START_BLOCK, useMulticall = false, abis = { - getReserves -}) { - let pairAddresses; - if (useMulticall) { - const pairLength = (await sdk.api.abi.call({ - target: FACTORY, - abi: factoryAbi.allPairsLength, - chain, - block - })).output - if (pairLength === null) { - throw new Error("allPairsLength() failed") - } - const pairNums = Array.from(Array(Number(pairLength)).keys()) - const pairs = (await sdk.api.abi.multiCall({ - abi: factoryAbi.allPairs, - chain, - calls: pairNums.map(num => ({ - target: FACTORY, - params: [num] - })), - block, - requery: true - })).output - pairAddresses = pairs.map(result => result.output.toLowerCase()) - } else { - const logs = ( - await sdk.api.util - .getLogs({ - keys: [], - toBlock: block, - chain, - target: FACTORY, - fromBlock: START_BLOCK, - topic: 'PairCreated(address,address,address,uint256)', - }) - ).output; - - pairAddresses = logs - // sometimes the full log is emitted - .map((log) => - typeof log === 'string' ? log : `0x${log.data.slice(64 - 40 + 2, 64 + 2)}` - ) - // lowercase - .map((pairAddress) => pairAddress.toLowerCase()); - } - - const [token0Addresses, token1Addresses, reserves] = await Promise.all([ - sdk.api.abi - .multiCall({ - abi: token0, - chain, - calls: pairAddresses.map((pairAddress) => ({ - target: pairAddress, - })), - block, - requery: true - }) - .then(({ output }) => output), - sdk.api.abi - .multiCall({ - abi: token1, - chain, - calls: pairAddresses.map((pairAddress) => ({ - target: pairAddress, - })), - block, - requery: true - }) - .then(({ output }) => output), - sdk.api.abi - .multiCall({ - abi: abis.getReserves, - chain, - calls: pairAddresses.map((pairAddress) => ({ - target: pairAddress, - })), - block, - requery: true - }).then(({ output }) => output), - ]); - - const pairs = {}; - // add token0Addresses - token0Addresses.forEach((token0Address) => { - const tokenAddress = token0Address.output.toLowerCase(); - - const pairAddress = token0Address.input.target.toLowerCase(); - pairs[pairAddress] = { - token0Address: getAddress(tokenAddress), - } - }); - - // add token1Addresses - token1Addresses.forEach((token1Address) => { - const tokenAddress = token1Address.output.toLowerCase(); - const pairAddress = token1Address.input.target.toLowerCase(); - pairs[pairAddress] = { - ...(pairs[pairAddress] || {}), - token1Address: getAddress(tokenAddress), - } - }); - - const balances = reserves.reduce((accumulator, reserve, i) => { - const pairAddress = reserve.input.target.toLowerCase(); - const pair = pairs[pairAddress] || {}; - - // handle reserve0 - if (pair.token0Address) { - const reserve0 = new BigNumber(reserve.output['0']); - if (!reserve0.isZero()) { - const existingBalance = new BigNumber( - accumulator[pair.token0Address] || '0' - ); - - accumulator[pair.token0Address] = existingBalance - .plus(reserve0) - .toFixed() - } - } - - // handle reserve1 - if (pair.token1Address) { - const reserve1 = new BigNumber(reserve.output['1']); - - if (!reserve1.isZero()) { - const existingBalance = new BigNumber( - accumulator[pair.token1Address] || '0' - ); - - accumulator[pair.token1Address] = existingBalance - .plus(reserve1) - .toFixed() - } - } - - return accumulator - }, {}); - - if (['cronos'].includes(chain)) - (await getFixBalances(chain))(balances); - - return balances -}; - -function uniTvlExport(factory, chain, transformAddressOriginal = undefined, abis) { - return async (timestamp, _ethBlock, chainBlocks) => { - let transformAddress; - if (transformAddressOriginal === undefined) { - transformAddress = await getChainTransform(chain); - } else { - transformAddress = await transformAddressOriginal() - } - const block = await getBlock(timestamp, chain, chainBlocks, true) - return calculateUniTvl(transformAddress, block, chain, factory, 0, true, abis) - } -} - -async function simpleAddUniTvl(balances, factory, chain, timestamp, chainBlocks) { - const transformAddress = addr => `${chain}:${addr}`; - const block = await getBlock(timestamp, chain, chainBlocks); - return calculateUniTvl(transformAddress, block, chain, factory, 0, true) -} - -module.exports = { - calculateUniTvl, - uniTvlExport, - simpleAddUniTvl -}; diff --git a/src/adapters/peggedAssets/llama-helper/chains.json b/src/adapters/peggedAssets/llama-helper/chains.json deleted file mode 100644 index fd1959b7..00000000 --- a/src/adapters/peggedAssets/llama-helper/chains.json +++ /dev/null @@ -1,137 +0,0 @@ -[ - "ethereum", - "bsc", - "polygon", - "fantom", - "avalanche", - "arbitrum", - "cronos", - "harmony", - "avax", - "heco", - "moonriver", - "solana", - "xdai", - "optimism", - "aurora", - "okexchain", - "terra", - "eos", - "moonbeam", - "metis", - "iotex", - "celo", - "boba", - "kcc", - "klaytn", - "oasis", - "staking", - "smartbch", - "fuse", - "tron", - "shiden", - "stacks", - "telos", - "cardano", - "pool2", - "algorand", - "near", - "kadena", - "kardia", - "songbird", - "csc", - "wax", - "syscoin", - "velas", - "rsk", - "astar", - "elastos", - "tomochain", - "theta", - "gochain", - "binance", - "polkadot", - "kusama", - "energyweb", - "borrowed", - "wan", - "hpb", - "tezos", - "ontology", - "bitcoin", - "curio", - "hoo", - "ergo", - "conflux", - "polis", - "kava", - "ronin", - "liquidchain", - "elrond", - "neo", - "nahmii", - "ultra", - "proton", - "thundercore", - "ubiq", - "callisto", - "cosmos", - "palm", - "ethereumclassic", - "thorchain", - "everscale", - "icon", - "bittorrent", - "vechain", - "waves", - "vite", - "vive", - "meter", - "zilliqa", - "godwoken", - "zksync", - "zyx", - "karura", - "milkomeda", - "evmos", - "dfk", - "crab", - "clover", - "hedera", - "rei", - "hydra", - "findora", - "osmosis", - "bitgert", - "reef", - "bitcoincash", - "doge", - "litecoin", - "secret", - "sora", - "candle", - "bifrost", - "stafi", - "lachain", - "coti", - "obyte", - "carbon", - "neo3", - "energi", - "palette", - "bytomsidechain", - "starcoin", - "fusion", - "reichain", - "ontology_evm", - "terra2", - "echelon", - "multivac", - "sx", - "lbry", - "rvn", - "ore", - "genshiro", - "aroric", - "sui" -] diff --git a/src/adapters/peggedAssets/llama-helper/compound.js b/src/adapters/peggedAssets/llama-helper/compound.js deleted file mode 100644 index 6456f52d..00000000 --- a/src/adapters/peggedAssets/llama-helper/compound.js +++ /dev/null @@ -1,332 +0,0 @@ - -const sdk = require('@defillama/sdk'); -const abi = require('./abis/compound.json'); -const { getBlock } = require('./getBlock'); -const { unwrapUniswapLPs } = require('./unwrapLPs'); -const { fixHarmonyBalances, fixOasisBalances, transformMetisAddress, fixBscBalances } = require('./portedTokens'); -const { usdtAddress } = require('./balances'); -const agoraAbi = require("./../agora/abi.json"); -// ask comptroller for all markets array -async function getAllCTokens(comptroller, block, chain) { - return (await sdk.api.abi.call({ - block, - target: comptroller, - params: [], - abi: abi['getAllMarkets'], - chain - })).output; -} - -async function getUnderlying(block, chain, cToken, cether, cetheEquivalent) { - if (cToken === cether) { - return cetheEquivalent - } - if (cToken === '0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5') { - return '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2';//cETH => WETH - } - if (cToken === '0x5C0401e81Bc07Ca70fAD469b451682c0d747Ef1c' && chain === 'avax') { - return "0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7" - } - return (await sdk.api.abi.call({ - block, - target: cToken, - abi: abi['underlying'], - chain - })).output; -} - -// returns {[underlying]: {cToken, decimals, symbol}} -async function getMarkets(comptroller, block, chain, cether, cetheEquivalent) { - let allCTokens = await getAllCTokens(comptroller, block, chain); - const markets = [] - // if not in cache, get from the blockchain - await ( - Promise.all(allCTokens.map(async (cToken) => { - try { - let underlying = await getUnderlying(block, chain, cToken, cether, cetheEquivalent); - markets.push({ underlying, cToken }) - } catch (e) { - console.log(`${cToken} market rugged, is that market CETH?`) - throw e - } - })) - ); - - return markets; -} -async function unwrapPuffTokens(balances, lpPositions, block) { - const pricePerShare = (await sdk.api.abi.multiCall({ - block, - abi: agoraAbi.getPricePerFullShare, - calls: lpPositions.map(p => ({ - target: p.token - })), - chain: 'metis' - })).output; - const underlying = (await sdk.api.abi.multiCall({ - block, - abi: agoraAbi.want, - calls: lpPositions.map(p => ({ - target: p.token - })), - chain: 'metis' - })).output; - - const newLpPositions = []; - for (let i = 0; i < lpPositions.length; i++) { - newLpPositions.push({ balance: lpPositions[i].balance * pricePerShare[i].output / 10 ** 18, token: underlying[i].output }) - }; - - await unwrapUniswapLPs( - balances, - newLpPositions, - block, - 'metis', - transformMetisAddress() - ); -}; -function getCompoundV2Tvl(comptroller, chain = "ethereum", transformAdress = addr => addr, cether = "0x4Ddc2D193948926D02f9B1fE9e1daa0718270ED5", cetheEquivalent = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2", borrowed = false, checkForLPTokens = undefined) { - return async (timestamp, ethBlock, chainBlocks) => { - const block = await getBlock(timestamp, chain, chainBlocks, true); - let balances = {}; - let markets = await getMarkets(comptroller, block, chain, cether, cetheEquivalent); - - // Get V2 tokens locked - let v2Locked = await sdk.api.abi.multiCall({ - block, - chain, - calls: markets.map((market) => ({ - target: market.cToken, - })), - abi: borrowed ? abi.totalBorrows : abi['getCash'], - }); - - let symbols; - if (checkForLPTokens !== undefined) { - symbols = await sdk.api.abi.multiCall({ - block, - chain, - calls: markets.map((market) => ({ - target: market.cToken, - })), - abi: "erc20:symbol", - }); - } - - const lpPositions = [] - markets.forEach((market, idx) => { - let getCash = v2Locked.output.find((result) => result.input.target === market.cToken); - if (checkForLPTokens !== undefined && checkForLPTokens(symbols.output[idx].output)) { - lpPositions.push({ - token: market.underlying, - balance: getCash.output - }) - } else { - sdk.util.sumSingleBalance(balances, transformAdress(market.underlying), getCash.output) - } - }); - if (chain == "harmony") { - fixHarmonyBalances(balances); - } else if (chain == "oasis") { - fixOasisBalances(balances); - } else if (chain == "bsc") { - fixBscBalances(balances); - } - if (comptroller == "0x92DcecEaF4c0fDA373899FEea00032E8E8Da58Da") { - await unwrapPuffTokens(balances, lpPositions, block) - } else if (lpPositions.length > 0) { - await unwrapUniswapLPs(balances, lpPositions, block, chain, transformAdress) - } - return balances; - } -} - -const BigNumber = require('bignumber.js').default; -const { toUSDTBalances } = require('./balances'); - -// ask comptroller for all markets array -async function getAllMarkets(block, chain, comptroller) { - const { output: markets } = await sdk.api.abi.call({ - target: comptroller, - abi: abi['getAllMarkets'], - block, - chain: chain, - }); - return markets; -} - -// ask comptroller for oracle -async function getOracle(block, chain, comptroller, oracleAbi) { - const { output: oracle } = await sdk.api.abi.call({ - target: comptroller, - abi: oracleAbi, - block, - chain: chain, - }); - return oracle; -} - -async function getUnderlyingDecimalsMultiple(block, chain, tokens, cether) { - const response = {} - const otherTokens = [] - tokens.forEach(token => { - if (token.toLowerCase() === cether?.toLowerCase()) { - response[token] = 18 - } else { - otherTokens.push(token) - } - }) - - try { - const underLyingCalls = otherTokens.map(t => ({ target: t })) - const { output: underlying } = await sdk.api.abi.multiCall({ - calls: underLyingCalls, - abi: abi['underlying'], - block, - chain, - }); - - const failed = underlying.find(i => !i.success) - if (failed) throw new Error('Something failed: ' + failed.input.target) - - const underlyingMapping = {} - const decimalsCalls = underlying.map(({ output }) => ({ target: output })) - underlying.forEach(({ input, output }) => underlyingMapping[output] = input.target) - const { output: decimals } = await sdk.api.abi.multiCall({ - calls: decimalsCalls, - abi: "erc20:decimals", - block, - chain, - }); - decimals.forEach(({ input, output }, i) => response[underlying[i].input.target] = output) - return response; - } catch (e) { - console.log(`${e.message} market rugged, is that market CETH?`) - throw e - } -} - -async function getCashMultiple(block, chain, tokens, borrowed) { - const calls = tokens.map(t => ({ target: t })) - const { output: cash } = await sdk.api.abi.multiCall({ - calls, - abi: borrowed ? abi.totalBorrows : abi['getCash'], - block, - chain, - }); - const response = {} - cash.forEach(({ input, output }) => response[input.target] = output) - return response; -} - -async function getUnderlyingPriceMultiple(block, chain, oracle, tokens, methodAbi) { - const calls = tokens.map(t => ({ params: [t] })) - const { output: underlyingPrice } = await sdk.api.abi.multiCall({ - target: oracle, - abi: methodAbi, - block, - chain, - calls, - }); - const response = {} - underlyingPrice.forEach(({ input, output }) => response[input.params[0]] = output) - return response; -} - - -function getCompoundUsdTvl(comptroller, chain, cether, borrowed, abis = { - oracle: abi['oracle'], - underlyingPrice: abi['getUnderlyingPrice'] -}, { - blacklist =[] -} = {}) { - return async (timestamp, ethBlock, chainBlocks) => { - const block = await getBlock(timestamp, chain, chainBlocks, true); - let tvl = new BigNumber('0'); - blacklist = blacklist.map(i => i.toLowerCase()) - let allMarkets = await getAllMarkets(block, chain, comptroller); - allMarkets = allMarkets.filter(token => !blacklist.includes(token.toLowerCase())) - let oracle = await getOracle(block, chain, comptroller, abis.oracle); - const amounts = await getCashMultiple(block, chain, allMarkets, borrowed) - const decimalsAll = await getUnderlyingDecimalsMultiple(block, chain, allMarkets, cether) - const underlyingPrices = await getUnderlyingPriceMultiple(block, chain, oracle, allMarkets, abis.underlyingPrice) - - allMarkets.forEach(token => { - let amount = new BigNumber(amounts[token]); - let decimals = decimalsAll[token]; - let locked = amount.div(10 ** decimals); - let underlyingPrice = new BigNumber(underlyingPrices[token]).div(10 ** (18 + 18 - decimals)) - tvl = tvl.plus(locked.times(underlyingPrice)); - }) - return toUSDTBalances(tvl.toNumber()); - } -} - -function compoundExports(comptroller, chain, cether, cetheEquivalent, transformAdressRaw, checkForLPTokens) { - const transformAddress = transformAdressRaw === undefined ? addr => `${chain}:${addr}` : transformAdressRaw - if (cether !== undefined && cetheEquivalent === undefined) { - throw new Error("You need to define the underlying for native cAsset") - } - return { - tvl: getCompoundV2Tvl(comptroller, chain, transformAddress, cether, cetheEquivalent, false, checkForLPTokens), - borrowed: getCompoundV2Tvl(comptroller, chain, transformAddress, cether, cetheEquivalent, true, checkForLPTokens) - } -} - -function compoundExportsWithAsyncTransform(comptroller, chain, cether, cetheEquivalent, transformAdressConstructor) { - return { - tvl: async (...args) => { - const transformAddress = await transformAdressConstructor() - return getCompoundV2Tvl(comptroller, chain, transformAddress, cether, cetheEquivalent)(...args) - }, - borrowed: async (...args) => { - const transformAddress = await transformAdressConstructor() - return getCompoundV2Tvl(comptroller, chain, transformAddress, cether, cetheEquivalent, true)(...args) - }, - } -} - -function fullCoumpoundExports(comptroller, chain, cether, cetheEquivalent, transformAdress) { - return { - timetravel: true, - doublecounted: false, - [chain]: compoundExports(comptroller, chain, cether, cetheEquivalent, transformAdress) - } -} - -function usdCompoundExports(comptroller, chain, cether, abis, options = {}) { - return { - tvl: getCompoundUsdTvl(comptroller, chain, cether, false, abis, options,), - borrowed: getCompoundUsdTvl(comptroller, chain, cether, true, abis, options,) - } -} - -function compoundExportsWithDifferentBase(comptroller, chain, token) { - const raw = usdCompoundExports(comptroller, chain) - async function tvl(...params) { - const tvl = await raw.tvl(...params) - return { - [token]: Number(tvl[usdtAddress]) / 1e6 - } - } - - async function borrowed(...params) { - const tvl = await raw.borrowed(...params) - return { - [token]: Number(tvl[usdtAddress]) / 1e6 - } - } - return { - tvl, - borrowed - } -} - -module.exports = { - getCompoundV2Tvl, - compoundExports, - compoundExportsWithAsyncTransform, - fullCoumpoundExports, - usdCompoundExports, - compoundExportsWithDifferentBase -}; diff --git a/src/adapters/peggedAssets/llama-helper/curvePools.js b/src/adapters/peggedAssets/llama-helper/curvePools.js deleted file mode 100644 index 627f8751..00000000 --- a/src/adapters/peggedAssets/llama-helper/curvePools.js +++ /dev/null @@ -1,390 +0,0 @@ -module.exports = { - // Curve.fi Factory USD Metapool: moUSD - '0x162b21ba1a90dd9384c615192fa4053217d2a8db': { - swapContract: '0x162B21ba1a90Dd9384C615192FA4053217D2A8Db', - underlyingTokens: ['0x9fFFb2F49adFC231B44dDCFf3FfCF0E81b06430A', '0x19793b454d3afc7b454f206ffe95ade26ca6912c'], - }, - // USDS3CRV - '0xde495223f7cd7ee0cde1addbd6836046bbdf3ad3': { - swapContract: '0xde495223f7cd7ee0cde1addbd6836046bbdf3ad3', - underlyingTokens: ['0x6c3f90f043a72fa612cbac8115ee7e52bde6e490', '0x45fdb1b92a649fb6a64ef1511d3ba5bf60044838'] - }, - // USDSam3CRV - '0xcf5186491739aac19db943d71a9b9b759f3afabf': { - swapContract: '0xcf5186491739aac19db943d71a9b9b759f3afabf', - underlyingTokens: ['0x2f1b1662A895C6Ba01a99DcAf56778E7d77e5609', '0x19793B454D3AfC7b454F206Ffe95aDE26cA6912c'] - }, - // USDSav3CRV - '0x90d5233b53436767fecacd1a783d3da8cc7395ed': { - swapContract: '0x90D5233b53436767fecACD1a783D3dA8Cc7395ED', - underlyingTokens: ['0xab05b04743e0aeaf9d2ca81e5d3b8385e4bf961e', '0x5b5cfe992adac0c9d48e05854b2d91c73a003858'] - }, - // ARTHuval3PS - '0x4cfaabd5920021359bb22bb6924cce708773b6ac': { - swapContract: '0x1d4b4796853aeda5ab457644a18b703b6ba8b4ab', - underlyingTokens: ['0x88fd584dF3f97c64843CD474bDC6F78e398394f4', '0x5b5bd8913d766d005859ce002533d4838b0ebbb5'], - }, - // val3PS - '0x5b5bd8913d766d005859ce002533d4838b0ebbb5': { - swapContract: '0x19ec9e3f7b21dd27598e7ad5aae7dc0db00a806d', - underlyingTokens: ['0xaed19dab3cd68e4267aec7b2479b1ed2144ad77f', '0xa6fdea1655910c504e974f7f1b520b74be21857b', '0x5f7f6cb266737b89f7af86b30f03ae94334b83e9'], - }, - // ARTHu3PS - '0xb38b49bae104bbb6a82640094fd61b341a858f78': { - swapContract: '0x98245bfbef4e3059535232d68821a58abb265c45', - underlyingTokens: ['0x88fd584dF3f97c64843CD474bDC6F78e398394f4', '0xaf4de8e872131ae328ce21d909c74705d3aaf452'], - }, - // 3EPS - '0xaf4de8e872131ae328ce21d909c74705d3aaf452': { - swapContract: '0x160caed03795365f3a589f10c379ffa7d75d4e76', - underlyingTokens: ['0xe9e7cea3dedca5984780bafc599bd69add087d56', '0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d', '0x55d398326f99059ff775485246999027b3197955'], - }, - '0x6c3f90f043a72fa612cbac8115ee7e52bde6e490': { - swapContract: '0xbEbc44782C7dB0a1A60Cb6fe97d0b483032FF1C7', - underlyingTokens: ['0xdac17f958d2ee523a2206206994597c13d831ec7', '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', '0x6b175474e89094c44da98b954eedeac495271d0f'], - }, - '0x075b1bb99792c9e1041ba13afef80c91a1e70fb3': { - swapContract: '0x7fC77b5c7614E1533320Ea6DDc2Eb61fa00A9714', - underlyingTokens: ['0xeb4c2781e4eba804ce9a9803c67d0893436bb27d', '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599', '0xfe18be6b3bd88a2d2a7f928d00292e7a9963cfc6'], - }, - // Nerve - '0xf2511b5e4fb0e5e2d123004b672ba14850478c14': { - swapContract: '0x1B3771a66ee31180906972580adE9b81AFc5fCDc', - underlyingTokens: ['0xe9e7cea3dedca5984780bafc599bd69add087d56', '0x55d398326f99059ff775485246999027b3197955', '0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d'], - }, - // DOP-LP BSC - '0x9116f04092828390799514bac9986529d70c3791': { - swapContract: '0x5162f992EDF7101637446ecCcD5943A9dcC63A8A', - underlyingTokens: [ - '0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3', - '0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56', - '0x55d398326f99059fF775485246999027B3197955', - '0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d' - ], - }, - // DOP-2P-LP BSC - '0x124166103814e5a033869c88e0f40c61700fca17': { - swapContract: '0x449256e20ac3ed7F9AE81c2583068f7508d15c02', - underlyingTokens: [ - '0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56', - '0x55d398326f99059fF775485246999027B3197955' - ], - }, - // DOP-UST-LP BSC - '0x7edcdc8cd062948ce9a9bc38c477e6aa244dd545': { - swapContract: '0x830e287ac5947B1C0DA865dfB3Afd7CdF7900464', - underlyingTokens: [ - '0x23396cF899Ca06c4472205fC903bDB4de249D6fC', - '0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56', - '0x55d398326f99059fF775485246999027B3197955' - ], - }, - // DOP-3P-LP BSC - '0xaa5509ce0ecea324bff504a46fc61eb75cb68b0c': { - swapContract: '0x61f864a7dFE66Cc818a4Fd0baabe845323D70454', - underlyingTokens: [ - '0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56', - '0x55d398326f99059fF775485246999027B3197955', - '0xfF54da7CAF3BC3D34664891fC8f3c9B6DeA6c7A5' - ], - }, - // 3P-QLP BSC - '0xb0f0983b32352a1cfaec143731ddd8a5f6e78b1f': { - swapContract: '0x3ED4b2070E3DB5eF5092F504145FB8150CfFE5Ea', - underlyingTokens: [ - '0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56', - '0x55d398326f99059fF775485246999027B3197955', - '0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d' - ], - }, - // IS3USD Polygon - '0xb4d09ff3dA7f9e9A2BA029cb0A81A989fd7B8f17': { - swapContract: '0x837503e8A8753ae17fB8C8151B8e6f586defCb57', - underlyingTokens: [ - '0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063', - '0xc2132D05D31c914a87C6611C10748AEb04B58e8F', - '0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174' - ] - }, - // am3CRV Polygon - '0xe7a24ef0c5e95ffb0f6684b813a78f2a3ad7d171': { - swapContract: '0x445FE580eF8d70FF569aB36e80c647af338db351', - underlyingTokens: [ - '0x27F8D03b3a2196956ED754baDc28D73be8830A6e', - '0x1a13F4Ca1d028320A707D99520AbFefca3998b7F', - '0x60D55F02A771d515e077c9C2403a1ef324885CeC' - ] - }, - // sCRV Eth - '0xc25a3a3b969415c80451098fa907ec722572917f': { - swapContract: '0xA5407eAE9Ba41422680e2e00537571bcC53efBfD', - underlyingTokens: [ - '0xdac17f958d2ee523a2206206994597c13d831ec7', - '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', - '0x6b175474e89094c44da98b954eedeac495271d0f', - '0x57ab1ec28d129707052df4df418d58a2d46d5f51' - ] - }, - // renBTC Eth - '0x49849c98ae39fff122806c06791fa73784fb3675': { - swapContract: '0x93054188d876f558f4a66B2EF1d97d16eDf0895B', - underlyingTokens: [ - '0xeb4c2781e4eba804ce9a9803c67d0893436bb27d', - '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599' - ] - }, - // lusd Eth - '0xed279fdd11ca84beef15af5d39bb4d4bee23f0ca': { - swapContract: '0xed279fdd11ca84beef15af5d39bb4d4bee23f0ca', - underlyingTokens: [ - '0x5f98805A4E8be255a32880FDeC7F6728C6568bA0', - '0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490' - ] - }, - // steCRV Eth - '0x06325440d014e39736583c165c2963ba99faf14e': { - swapContract: '0xdc24316b9ae028f1497c275eb9192a3ea0f67022', - underlyingTokens: ['0xae7ab96520de3a18e5e111b5eaab095312d7fe84'] - }, - // fraxCRV Eth - '0xd632f22692fac7611d2aa1c0d552930d43caed3b': { - swapContract: '0xd632f22692fac7611d2aa1c0d552930d43caed3b', - underlyingTokens: [ - '0x853d955acef822db058eb8505911ed77f175b99e', - '0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490' - ] - }, - // seCRV Eth - '0xa3d87fffce63b53e0d54faa1cc983b7eb0b74a9c': { - swapContract: '0xc5424B857f758E906013F3555Dad202e4bdB4567', - underlyingTokens: ['0x5e74C9036fb86BD7eCdcb084a0673EFc32eA31cb'] - }, - // btcCRV Polygon - '0xf8a57c1d3b9629b77b6726a042ca48990a84fb49': { - swapContract: '0xC2d95EEF97Ec6C17551d45e77B590dc1F9117C67', - underlyingTokens: [ - '0x5c2ed810328349100A66B82b78a1791B101C9D61', - '0xDBf31dF14B66535aF65AaC99C32e9eA844e14501' - ] - }, - // tricryptoCRV v1 Polygon - '0x8096ac61db23291252574D49f036f0f9ed8ab390': { - swapContract: '0x751B1e21756bDbc307CBcC5085c042a0e9AaEf36', - underlyingTokens: [ - '0x28424507fefb6f7f8e9d3860f56504e4e5f5f390', - '0x5c2ed810328349100a66b82b78a1791b101c9d61', - '0xe7a24ef0c5e95ffb0f6684b813a78f2a3ad7d171' - ] - }, - // tricryptoCRV v2 Polygon - '0xbece5d20a8a104c54183cc316c8286e3f00ffc71': { - swapContract: '0x92577943c7aC4accb35288aB2CC84D75feC330aF', - underlyingTokens: [ - '0x28424507fefb6f7f8e9d3860f56504e4e5f5f390', - '0x5c2ed810328349100a66b82b78a1791b101c9d61', - '0xe7a24ef0c5e95ffb0f6684b813a78f2a3ad7d171' - ] - }, - // tricryptoCRV v3 Polygon - '0xdad97f7713ae9437fa9249920ec8507e5fbb23d3': { - swapContract: '0x92215849c439e1f8612b6646060b4e3e5ef822cc', - underlyingTokens: [ - '0x28424507fefb6f7f8e9d3860f56504e4e5f5f390', - '0x5c2ed810328349100a66b82b78a1791b101c9d61', - '0xe7a24ef0c5e95ffb0f6684b813a78f2a3ad7d171' - ] - }, - // 4eur-f Polygon - '0xad326c253a84e9805559b73a08724e11e49ca651': { - swapContract: '0xad326c253a84e9805559b73a08724e11e49ca651', - underlyingTokens: [ - '0xe111178a87a3bff0c8d18decba5798827539ae99', - '0x4e3decbb3645551b8a19f0ea1678079fcb33fb4c', - '0x7BDF330f423Ea880FF95fC41A280fD5eCFD3D09f', - '0xe2aa7db6da1dae97c5f5c6914d285fbfcc32a128' - ] - }, - // gondolaDAIeUSDTe Avax - '0xd7d4a4c67e9c1f5a913bc38e87e228f4b8820e8a': { - swapContract: '0xCF97190fAAfea63523055eBd139c008cdb4468eB', - underlyingTokens: [ - '0xd586E7F844cEa2F87f50152665BCbc2C279D8d70', - '0xc7198437980c041c805a1edcba50c1ce5db95118' - ] - }, - // gondolaYAKPool Avax - '0x7f1e6a8730fec77f27daeecd82e1941518383a62': { - swapContract: '0xd72Dc856868f964D37D01CeA7A7a3c1F4da4F98f', - underlyingTokens: [ - '0xddaaad7366b455aff8e7c82940c43ceb5829b604', - '0x59414b3089ce2af0010e7523dea7e2b35d776ec7' - ] - }, - // gondolaUSDCe Avax - '0x4dc5a6308338e540aa97faab7fd2e03876075413': { - swapContract: '0x4b941276eb39d114c89514791d073a085acba3c0', - underlyingTokens: [ - '0xc7198437980c041c805a1edcba50c1ce5db95118', - '0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664' - ] - }, - // av3CRV Avax - '0x1337bedc9d22ecbe766df105c9623922a27963ec': { - swapContract: '0x7f90122BF0700F9E7e1F688fe926940E8839F353', - underlyingTokens: [ - '0x47AFa96Cdc9fAb46904A55a6ad4bf6660B53c38a', - '0x46A51127C3ce23fb7AB1DE06226147F446e4a857', - '0x532E6537FEA298397212F09A61e03311686f548e' - ] - }, - // MIM-fUSDT-USDC Fantom - '0x2dd7c9371965472e5a5fd28fbe165007c61439e1': { - swapContract: '0x2dd7C9371965472E5A5fD28fbE165007c61439E1', - underlyingTokens: [ - '0x82f0B8B456c1A451378467398982d4834b6829c1', - '0x049d68029688eAbF473097a2fC38ef61633A3C7A', - '0x04068DA6C83AFCFA0e13ba15A6696662335D5B75' - ] - }, - // Dai-Usdc Fantom - '0x27e611fd27b276acbd5ffd632e5eaebec9761e40': { - swapContract: '0x27E611FD27b276ACbd5Ffd632E5eAEBEC9761E40', - underlyingTokens: [ - '0x04068DA6C83AFCFA0e13ba15A6696662335D5B75', - '0x8D11eC38a3EB5E956B052f67Da8Bdc9bef8Abf3E' - ] - }, - // gDai-gUSDC-gUSDT Fantom - '0xd02a30d33153877bc20e5721ee53dedee0422b2f': { - swapContract: '0x0fa949783947Bf6c1b171DB13AEACBB488845B3f', - underlyingTokens: [ - '0x940F41F0ec9ba1A34CF001cc03347ac092F5F6B5', - '0x07E6332dD090D287d3489245038daF987955DCFB', - '0xe578C856933D8e1082740bf7661e379Aa2A30b26' - ] - }, - // tricrypto Fantom - '0x58e57ca18b7a47112b877e31929798cd3d703b0f': { - swapContract: '0x3a1659Ddcf2339Be3aeA159cA010979FB49155FF', - underlyingTokens: [ - '0x74b23882a30290451A17c44f4F05243b6b58C76d', - '0x321162Cd933E2Be498Cd2267a90534A804051b11', - '0x049d68029688eAbF473097a2fC38ef61633A3C7A' - ] - }, - // btc-renbtc Fantom - '0x5b5cfe992adac0c9d48e05854b2d91c73a003858': { - swapContract: '0x3eF6A01A0f81D6046290f3e2A8c5b843e738E604', - underlyingTokens: [ - '0xDBf31dF14B66535aF65AaC99C32e9eA844e14501', - '0x321162Cd933E2Be498Cd2267a90534A804051b11' - ] - }, - // mim pool avax - '0xaea2e71b631fa93683bcf256a8689dfa0e094fcd': { - swapContract: '0xaea2e71b631fa93683bcf256a8689dfa0e094fcd', - underlyingTokens: [ - '0xc7198437980c041c805a1edcba50c1ce5db95118', - '0xa7d7079b0fead91f3e65f86e8915cb59c1a4c664', - '0x130966628846bfd36ff31a822705796e8cb8c18d', - ] - }, - // EURS/sEUR Eth - '0x194ebd173f6cdace046c53eacce9b953f28411d1': { - swapContract: '0x0ce6a5ff5217e38315f87032cf90686c96627caa', - underlyingTokens: [ - '0xd71ecff9342a5ced620049e616c5035f1db98620', - '0xdb25f211ab05b1c97d595516f45794528a807ad8' - ] - }, - // aDAI/aUSDC/aUSDT (a3CRV) Eth - '0xfd2a8fa60abd58efe3eee34dd494cd491dc14900': { - swapContract: '0xdebf20617708857ebe4f679508e7b7863a8a8eee', - underlyingTokens: [ - '0x028171bca77440897b824ca71d1c56cac55b68a3', - '0xbcca60bb61934080951369a648fb03df4f96263c', - '0x3ed3b47dd13ec9a98b44e6204a523e766b225811' - ] - }, - // MIM / USDT/USDC/DAI Eth - '0x5a6a4d54456819380173272a5e8e9b9904bdf41b': { - swapContract: '0x5a6A4D54456819380173272A5E8E9B9904BdF41B', - underlyingTokens: [ - '0x99D8a9C45b2ecA8864373A26D1459e3Dff1e17F3', - '0x6c3F90f043a72FA612cbac8115EE7e52BDe6E490', - ], - }, - // ETH / alETH Eth - '0xc4c319e2d4d66cca4464c0c2b32c9bd23ebe784e': { - swapContract: '0xC4C319E2D4d66CcA4464C0c2B32c9Bd23ebe784e', - underlyingTokens: ['0x0100546F2cD4C9D97f798fFC9755E47865FF7Ee6'], - }, - // LINK / sLINK Eth - '0xcee60cfa923170e4f8204ae08b4fa6a3f5656f3a': { - swapContract: '0xF178C0b5Bb7e7aBF4e12A4838C7b7c5bA2C623c0', - underlyingTokens: [ - '0x514910771AF9Ca656af840dff83E8264EcF986CA', - '0xbBC455cb4F1B9e4bFC4B73970d360c8f032EfEE6', - ], - }, - // 3CRV Harmony - '0xc5cfada84e902ad92dd40194f0883ad49639b023': { - swapContract: '0xc5cfada84e902ad92dd40194f0883ad49639b023', - underlyingTokens: [ - '0xef977d2f931c1978db5f6747666fa1eacb0d0339', - '0x985458e523db3d53125813ed68c274899e9dfab4', - '0x3c2b8be99c50593081eaa2a724f0b8285f5aba8f' - ] - }, - // VST-FRAX Arbitrum - '0x59bf0545fca0e5ad48e13da269facd2e8c886ba4': { - swapContract: '0x59bf0545fca0e5ad48e13da269facd2e8c886ba4', - underlyingTokens: [ - '0x64343594ab9b56e99087bfa6f2335db24c2d1f17', - '0x17FC002b466eEc40DaE837Fc4bE5c67993ddBd6F', - ] - }, - // pBTC-sBTC Ethereum - '0xde5331ac4b3630f94853ff322b66407e0d6331e8': { - swapContract: '0x7F55DDe206dbAD629C080068923b36fe9D6bDBeF', - underlyingTokens: [ - '0x5228a22e72ccC52d415EcFd199F99D0665E7733b', - '0x075b1bb99792c9e1041ba13afef80c91a1e70fb3', - ] - }, - // TOKEMAKS START - '0x9462f2b3c9beea8afc334cdb1d1382b072e494ea': { - swapContract: '0x9462f2b3c9beea8afc334cdb1d1382b072e494ea', - underlyingTokens: ['0x6BeA7CFEF803D1e3d5f7C0103f7ded065644e197'] - }, - '0x50b0d9171160d6eb8aa39e090da51e7e078e81c4': { - swapContract: '0x50b0d9171160d6eb8aa39e090da51e7e078e81c4', - underlyingTokens: ['0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F'] - }, - '0xcaf8703f8664731ced11f63bb0570e53ab4600a9': { - swapContract: '0xcaf8703f8664731ced11f63bb0570e53ab4600a9', - underlyingTokens: ['0x4104b135DBC9609Fc1A9490E61369036497660c8'] - }, - '0x01fe650ef2f8e2982295489ae6adc1413bf6011f': { - swapContract: '0x01fe650ef2f8e2982295489ae6adc1413bf6011f', - underlyingTokens: ['0x9C4A4204B79dd291D6b6571C5BE8BbcD0622F050'] - }, - '0xc250b22d15e43d95fbe27b12d98b6098f8493eac': { - swapContract: '0xc250b22d15e43d95fbe27b12d98b6098f8493eac', - underlyingTokens: ['0xc770EEfAd204B5180dF6a14Ee197D99d808ee52d'] - }, - '0x0437ac6109e8a366a1f4816edf312a36952db856': { - swapContract: '0x0437ac6109e8a366a1f4816edf312a36952db856', - underlyingTokens: ['0x6B3595068778DD592e39A122f4f5a5cF09C90fE2'] - }, - '0x9001a452d39a8710d27ed5c2e10431c13f5fba74': { - swapContract: '0x9001a452d39a8710d27ed5c2e10431c13f5fba74', - underlyingTokens: ['0xdBdb4d16EdA451D0503b854CF79D55697F90c8DF'] - }, - '0x961226b64ad373275130234145b96d100dc0b655': { - swapContract: '0x961226b64ad373275130234145b96d100dc0b655', - underlyingTokens: ['0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0'] - }, - // TOKEMAKS END - -} \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/eos.js b/src/adapters/peggedAssets/llama-helper/eos.js deleted file mode 100644 index b25a85d1..00000000 --- a/src/adapters/peggedAssets/llama-helper/eos.js +++ /dev/null @@ -1,73 +0,0 @@ -const axios = require('axios') -const retry = require('../helper/retry') - -const RPC_ENDPOINTS = { - 'eos': 'https://eos.greymass.com', - 'wax': 'https://wax.greymass.com', - 'telos': 'https://telos.greymass.com', -} - -async function get_currency_balance(code, account, symbol, chain = "eos") { - const response = await retry(async () => await axios.default.post(`${RPC_ENDPOINTS[chain]}/v1/chain/get_currency_balance`, {code, account, symbol})); - try { - return Number(response.data[0].split(" ")[0]); - } catch (e) { - return 0; - } -} - -/** - * Get symbol precision - * - * @example - * - * get_precision("EOS"); - * // => 4 - * get_precision("4,EOS"); - * // => 4 - * get_precision("8,WAX"); - * // => 8 - */ -function get_precision( symbol ) -{ - if ( symbol.includes(",") ) return symbol.split(",")[0]; - if ( symbol == "EOS") return 4; - if ( symbol == "TLOS") return 4; - if ( symbol == "WAX") return 8; - return 4; -} - -// native staked CPU/Net & REX should be counted as liquid balance -async function get_staked(account_name, symbol, chain = "eos") { - const response = await retry(async () => await axios.default.post(`${RPC_ENDPOINTS[chain]}/v1/chain/get_account`, { account_name })); - try { - return response.data.voter_info.staked / (10 ** get_precision( symbol )) - } catch (e) { - return 0; - } -} - -async function get_account_tvl(accounts, tokens, chain = "eos") { - const balances = {} - - // support single or multiple accounts - for ( const account of Array.isArray(accounts) ? accounts : [ accounts ] ) { - for ( const [ code, symbol, id ] of tokens ) { - const balance = await get_currency_balance(code, account, symbol, chain); - - // support native staking as balance - const staked = code == "eosio.token" ? await get_staked(account, symbol, chain) : 0; - - // support adding same balance from multiple accounts - if ( balances[id] ) balances[id] += balance + staked; - else balances[id] = balance + staked; - } - } - return balances; -} - -module.exports = { - get_staked, - get_currency_balance, - get_account_tvl, -} \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/exports.js b/src/adapters/peggedAssets/llama-helper/exports.js deleted file mode 100644 index df6aef01..00000000 --- a/src/adapters/peggedAssets/llama-helper/exports.js +++ /dev/null @@ -1,33 +0,0 @@ -const sdk = require('@defillama/sdk') - -function chainExports(chainTvl, chains){ - const chainTvls = chains.reduce((obj, chain) => ({ - ...obj, - [chain === 'avax' ? 'avalanche' : chain]: { - tvl:chainTvl(chain) - } - }), {}) - - return chainTvls -} - -function fetchChainExports(chainTvl, chains){ - const chainTvls = chains.reduce((obj, chain) => ({ - ...obj, - [chain === 'avax' ? 'avalanche' : chain]: { - fetch:chainTvl(chain) - } - }), {}) - - return { - ...chainTvls, - fetch: ()=>{ - return Promise.all(chains.map(c=>chainTvl(c)())).then(cs=>cs.reduce((total, c)=>total+c, 0)) - } - } -} - -module.exports={ - chainExports, - fetchChainExports -} \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/formatAddressChecksum.js b/src/adapters/peggedAssets/llama-helper/formatAddressChecksum.js deleted file mode 100644 index bb7700b0..00000000 --- a/src/adapters/peggedAssets/llama-helper/formatAddressChecksum.js +++ /dev/null @@ -1,17 +0,0 @@ -/** - * @dev This function will format an address string according to the avilability of EIP-1191 on the network. - * This EIP determines the way the address checksum is being calculated. - * For example, on RSK (which implemented EIP-1191) any js/ts call to the blockchain for getting/connecting to a contract - * will have to be done with a low case address, while on a non EIP-1191 netwrok it has to remain mix-case. - * For more information please read: https://developers.rsk.co/rsk/architecture/account-based/ - */ -function formatAddressChecksum(address, netwrokName) { - // Add here more EIP-1191 networks as needed - return ["rsk"].includes(netwrokName?.toLowerCase()) - ? address.toLowerCase() - : address; -} - -module.exports = { - formatAddressChecksum, -}; diff --git a/src/adapters/peggedAssets/llama-helper/getBlock.js b/src/adapters/peggedAssets/llama-helper/getBlock.js deleted file mode 100644 index 9878323a..00000000 --- a/src/adapters/peggedAssets/llama-helper/getBlock.js +++ /dev/null @@ -1,20 +0,0 @@ -const sdk = require('@defillama/sdk') -const retry = require('async-retry') -const axios = require("axios"); - -async function getBlock(timestamp, chain, chainBlocks, undefinedOk = false) { - if (chainBlocks[chain] !== undefined || (process.env.HISTORICAL === undefined && undefinedOk)) { - return chainBlocks[chain] - } else { - if(chain === "celo"){ - return Number((await retry(async bail => await axios.get("https://explorer.celo.org/api?module=block&action=getblocknobytime×tamp=" + timestamp + "&closest=before"))).data.result.blockNumber); - } else if(chain === "moonriver") { - return Number((await retry(async bail => await axios.get(`https://blockscout.moonriver.moonbeam.network/api?module=block&action=getblocknobytime×tamp=${timestamp}&closest=before`))).data.result.blockNumber); - } - return sdk.api.util.lookupBlock(timestamp, { chain }).then(blockData => blockData.block) - } -} - -module.exports = { - getBlock, -}; \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/getChainList.js b/src/adapters/peggedAssets/llama-helper/getChainList.js deleted file mode 100644 index e094c40e..00000000 --- a/src/adapters/peggedAssets/llama-helper/getChainList.js +++ /dev/null @@ -1,96 +0,0 @@ -const fs = require('fs') -const path = require('path') - -const projectsFolder = path.join(__dirname, '..') - -const files = fs.readdirSync(projectsFolder, { withFileTypes: true }) -const whitelistedKeys = require('./whitelistedExportKeys.json') - -const projectNames = [] -const rModules = [] -const projectMissingChainNames = [] -const keysCount = {} -const chainCount = {} - - -files.forEach(i => { - if (['config', 'helper'].includes(i.name)) return; - let fPath - try { - if (i.isFile()) { - fPath = path.join(projectsFolder, i.name) - rModules.push(getModule(fPath, i.name)) - projectNames.push(i.name) - return; - } - fPath = path.join(projectsFolder, i.name, 'index.js') - if (checkFileExistsSync(fPath)) { - rModules.push(getModule(fPath, i.name)) - projectNames.push(i.name) - return; - } - console.log('Adapter wrong? ', i.name) - } catch (e) { - // console.error(e) - console.log('error in', i.name) - } -}) - - -function getModule(fPath, projectName) { - let module = require(fPath) - delete module.hallmarks - if (typeof module.tvl === 'function') { - const chainsWithTVL = Object.keys(module).filter(chain => typeof module[chain] === 'object' && typeof module[chain].tvl === 'function') - if (chainsWithTVL.length) console.log('I am confused:', projectName, chainsWithTVL) - else module.ethereum = { tvl: module.tvl } - delete module.tvl - } - - Object.keys(module).filter(k => typeof module[k] !== 'object') - .forEach(i => { - addKey(i, projectName) - delete module[i] - }) - - Object.keys(module).forEach(chain => { - Object.keys(module[chain]).forEach(key => addKey(key, `${projectName}-${chain}`)) - }) - return module -} - -function addKey(key, label) { - if (whitelistedKeys.includes(key)) return; - if (!keysCount[key]) keysCount[key] = [] - keysCount[key].push(label) -} - - - -rModules.forEach((module, i) => { - if (!Object.keys(module).length) return projectMissingChainNames.push(projectNames[i]) - Object.keys(module).forEach(chain => { - if (!chainCount[chain]) chainCount[chain] = [] - chainCount[chain].push(projectNames[i]) - }) -}) - -// console.log(`projectMissingChainNames count: `, projectMissingChainNames.length, projectMissingChainNames.join(', ')) -// console.log(`Chain count: `, Object.keys(chainCount).length) -const chainCountTable = Object.keys(chainCount).map((chain) => [chain, chainCount[chain].length, chainCount[chain]]).sort((a, b) => b[1] - a[1]) -const keyCountTable = Object.keys(keysCount).map((key) => [key, keysCount[key].length, keysCount[key]]).sort((a, b) => b[1] - a[1]) -console.table(chainCountTable) -console.table(keyCountTable) -const chainNames = chainCountTable.map(([chain]) => chain) - -fs.writeFileSync(path.join(__dirname, 'chains.json'), JSON.stringify(chainNames, null, 2)) - -function checkFileExistsSync(filepath) { - let flag = true; - try { - fs.accessSync(filepath, fs.constants.F_OK); - } catch (e) { - flag = false; - } - return flag; -} \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/getEfficientUsdUniTvl.js b/src/adapters/peggedAssets/llama-helper/getEfficientUsdUniTvl.js deleted file mode 100644 index 670a398a..00000000 --- a/src/adapters/peggedAssets/llama-helper/getEfficientUsdUniTvl.js +++ /dev/null @@ -1,176 +0,0 @@ -const sdk = require('@defillama/sdk'); -const token0 = require('./abis/token0.json'); -const token1 = require('./abis/token1.json'); -const getReserves = require('./abis/getReserves.json'); -const factoryAbi = require('./abis/factory.json'); -const { getBlock } = require('./getBlock'); - -async function requery(results, chain, block, abi) { - if (results.some(r => !r.success)) { - const failed = results.map((r, i) => [r, i]).filter(r => !r[0].success) - const newResults = await sdk.api.abi - .multiCall({ - abi, - chain, - calls: failed.map((f) => f[0].input), - block, - }).then(({ output }) => output); - failed.forEach((f, i) => { - results[f[1]] = newResults[i] - }) - } -} - -function sum(balances, token, amount) { - if (balances[token] === undefined) { - balances[token] = 0 - } - balances[token] += Number(amount) -} - -function setPrice(prices, address, coreAmount, tokenAmount) { - if (prices[address] !== undefined) { - const currentCoreAmount = prices[address][0] - if (coreAmount < currentCoreAmount) { - return - } - } - prices[address] = [Number(coreAmount), Number(coreAmount) / Number(tokenAmount)] -} - -const step = 10e3; - -function calculateUsdUniTvl(FACTORY, chain, coreAssetRaw, whitelistRaw, coreAssetName, decimals = 18) { - const whitelist = whitelistRaw.map(t => t.toLowerCase()) - const coreAsset = coreAssetRaw.toLowerCase() - return async (timestamp, ethBlock, chainBlocks) => { - const block = await getBlock(timestamp, chain, chainBlocks) - - let pairAddresses; - const pairLengthRaw = (await sdk.api.abi.call({ - target: FACTORY, - abi: factoryAbi.allPairsLength, - chain, - block - })).output - if (pairLengthRaw === null) { - throw new Error("allPairsLength() failed") - } - const prices = {} - let coreBalance = 0 - const pairLength = Number(pairLengthRaw) - for (let floor = 0; floor < pairLength; floor += step) { - const pairNums = Array.from(Array(Number(step)).keys()).map(k=>k+floor) - { - const pairs = (await sdk.api.abi.multiCall({ - abi: factoryAbi.allPairs, - chain, - calls: pairNums.map(num => ({ - target: FACTORY, - params: [num] - })), - block - })).output - await requery(pairs, chain, block, factoryAbi.allPairs); - pairAddresses = pairs.map(result => result.output.toLowerCase()) - } - - const [token0Addresses, token1Addresses, reserves] = await Promise.all([ - sdk.api.abi - .multiCall({ - abi: token0, - chain, - calls: pairAddresses.map((pairAddress) => ({ - target: pairAddress, - })), - block, - }) - .then(({ output }) => output), - sdk.api.abi - .multiCall({ - abi: token1, - chain, - calls: pairAddresses.map((pairAddress) => ({ - target: pairAddress, - })), - block, - }) - .then(({ output }) => output), - sdk.api.abi - .multiCall({ - abi: getReserves, - chain, - calls: pairAddresses.map((pairAddress) => ({ - target: pairAddress, - })), - block, - }).then(({ output }) => output), - ]); - await requery(token0Addresses, chain, block, token0); - await requery(token1Addresses, chain, block, token1); - await requery(reserves, chain, block, getReserves); - - const pairs = {}; - // add token0Addresses - token0Addresses.forEach((token0Address) => { - const tokenAddress = token0Address.output.toLowerCase(); - - const pairAddress = token0Address.input.target.toLowerCase(); - pairs[pairAddress] = { - token0Address: tokenAddress, - } - }); - - // add token1Addresses - token1Addresses.forEach((token1Address) => { - const tokenAddress = token1Address.output.toLowerCase(); - const pairAddress = token1Address.input.target.toLowerCase(); - pairs[pairAddress] = { - ...(pairs[pairAddress] || {}), - token1Address: tokenAddress, - } - }); - - const balances = {} - for (let i = 0; i < reserves.length; i++) { - const pairAddress = reserves[i].input.target.toLowerCase(); - const pair = pairs[pairAddress]; - const token0Address = pair.token0Address.toLowerCase() - const token1Address = pair.token1Address.toLowerCase() - const reserveAmounts = reserves[i].output - if (token0Address === coreAsset) { - coreBalance += Number(reserveAmounts[0]) * 2 - if (whitelist.includes(token1Address)) { - setPrice(prices, token1Address, reserveAmounts[0], reserveAmounts[1]) - } - } else if (token1Address === coreAsset) { - coreBalance += Number(reserveAmounts[1]) * 2 - if (whitelist.includes(token0Address)) { - setPrice(prices, token0Address, reserveAmounts[1], reserveAmounts[0]) - } - } else { - const whitelistedToken0 = whitelist.find(t => t === token0Address) - const whitelistedToken1 = whitelist.find(t => t === token1Address) - if (whitelistedToken0 !== undefined) { - sum(balances, whitelistedToken0, Number(reserveAmounts[0]) * 2) - } else if (whitelistedToken1 !== undefined) { - sum(balances, whitelistedToken1, Number(reserveAmounts[1]) * 2) - } - } - } - Object.entries(balances).forEach(([address, amount]) => { - const price = prices[address]; - if (price !== undefined) { - coreBalance += price[1] * (amount ?? 0) - } - }) - } - return { - [coreAssetName]: (coreBalance) / (10 ** decimals) - } - } -}; - -module.exports = { - calculateUsdUniTvl, -}; diff --git a/src/adapters/peggedAssets/llama-helper/getTokens.js b/src/adapters/peggedAssets/llama-helper/getTokens.js deleted file mode 100644 index 4773fd80..00000000 --- a/src/adapters/peggedAssets/llama-helper/getTokens.js +++ /dev/null @@ -1,16 +0,0 @@ -const axios = require('axios') - -const chainIds = { - 'ethereum': 1, - 'bsc': 56, - 'polygon': 137 -} - -async function getTokens(address, chain = "ethereum"){ - const allTokens = (await axios.get(`https://api.covalenthq.com/v1/${chainIds[chain]}/address/${address}/balances_v2/?&key=ckey_72cd3b74b4a048c9bc671f7c5a6`)).data.data.items.filter(t=>t.contract_address !== "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"); - return allTokens.map(token=>token.contract_address); -} - -module.exports = { - getTokens -} diff --git a/src/adapters/peggedAssets/llama-helper/getUniFactory.js b/src/adapters/peggedAssets/llama-helper/getUniFactory.js deleted file mode 100644 index 55c95936..00000000 --- a/src/adapters/peggedAssets/llama-helper/getUniFactory.js +++ /dev/null @@ -1,20 +0,0 @@ -const sdk = require('@defillama/sdk') - -const router = "0x3881e447F439891dC106Da7bca0007B319eeB74D"; -const chain = 'gochain'; - -async function getFactory(){ - const factory = await sdk.api.abi.call({ - target: router, - chain, - abi: {"inputs":[],"name":"factory","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}, - }) - const wrappedToken = await sdk.api.abi.call({ - target: router, - chain, - abi: {"inputs":[],"name":"WETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}, - }) - console.log("factory", factory.output) - console.log("wrapped token", wrappedToken.output) -} -getFactory() \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/getUniSubgraphTvl.js b/src/adapters/peggedAssets/llama-helper/getUniSubgraphTvl.js deleted file mode 100644 index a452c810..00000000 --- a/src/adapters/peggedAssets/llama-helper/getUniSubgraphTvl.js +++ /dev/null @@ -1,77 +0,0 @@ -const { request, gql } = require("graphql-request"); -const { toUSDTBalances } = require('../helper/balances'); -const { getBlock } = require('../helper/getBlock'); -const { blockQuery } = require('./graph') - -function getChainTvl(graphUrls, factoriesName = "uniswapFactories", tvlName = "totalLiquidityUSD", blockCatchupLimit) { - const graphQuery = gql` -query get_tvl($block: Int) { - ${factoriesName}( - block: { number: $block } - ) { - ${tvlName} - } -} -`; - return (chain) => { - return async (timestamp, ethBlock, chainBlocks) => { - const block = await getBlock(timestamp, chain, chainBlocks) - let uniswapFactories - - if (!blockCatchupLimit) { - uniswapFactories = (await request(graphUrls[chain], graphQuery, { block, }))[factoriesName]; - } else { - uniswapFactories = (await blockQuery(graphUrls[chain], graphQuery, block, blockCatchupLimit))[factoriesName]; - } - - const usdTvl = Number(uniswapFactories[0][tvlName]) - return toUSDTBalances(usdTvl) - } - } -} - -function getChainTvlBuffered(graphUrls, bufferSeconds, factoriesName = "uniswapFactories", tvlName = "totalLiquidityUSD") { - const chainFn = getChainTvl(graphUrls, factoriesName, tvlName) - return (chain) => { - const tvl = chainFn(chain) - return async (timestamp, ethBlock, chainBlocks) => { - timestamp -= bufferSeconds - for (const chainName in chainBlocks) { - chainBlocks[chainName] = await getBlock(timestamp, chainName, {}, false) - } - ethBlock = chainBlocks['ethereum'] - return await tvl(timestamp, ethBlock, chainBlocks) - } - } -} - -function getAvaxUniswapTvl(graphUrl, factoriesName = "uniswapFactories", tvlName = "totalLiquidityETH") { - const graphQuery = gql` -query get_tvl($block: Int) { - ${factoriesName}( - block: { number: $block } - ) { - ${tvlName} - } -} -`; - return async (timestamp, ethBlock, chainBlocks) => { - const response = await request( - graphUrl, - graphQuery, - { - block: chainBlocks.avax, - } - ); - - return { - 'avalanche-2': Number(response[factoriesName][0].totalLiquidityETH) - } - } -} - -module.exports = { - getChainTvl, - getChainTvlBuffered, - getAvaxUniswapTvl -} \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/getUsdUniTvl.js b/src/adapters/peggedAssets/llama-helper/getUsdUniTvl.js deleted file mode 100644 index f0d93bed..00000000 --- a/src/adapters/peggedAssets/llama-helper/getUsdUniTvl.js +++ /dev/null @@ -1,303 +0,0 @@ -const BigNumber = require('bignumber.js'); -const sdk = require('@defillama/sdk'); -const token0 = require('./abis/token0.json'); -const token1 = require('./abis/token1.json'); -const getReserves = require('./abis/getReserves.json'); -const factoryAbi = require('./abis/factory.json'); -const { getBlock } = require('./getBlock'); -const { getChainTransform, getFixBalances } = require('./portedTokens') - -async function requery(results, chain, block, abi) { - if (results.some(r => !r.success)) { - const failed = results.map((r, i) => [r, i]).filter(r => !r[0].success) - const newResults = await sdk.api.abi - .multiCall({ - abi, - chain, - calls: failed.map((f) => f[0].input), - block, - }).then(({ output }) => output); - failed.forEach((f, i) => { - results[f[1]] = newResults[i] - }) - } -} - -function sum(balances, token, amount) { - if (balances[token] === undefined) { - balances[token] = 0 - } - balances[token] += Number(amount) -} - -function setPrice(prices, address, coreAmount, tokenAmount) { - if (prices[address] !== undefined) { - const currentCoreAmount = prices[address][0] - if (coreAmount < currentCoreAmount) { - return - } - } - prices[address] = [Number(coreAmount), Number(coreAmount) / Number(tokenAmount)] -} - -function calculateUsdUniTvl(FACTORY, chain, coreAssetRaw, whitelistRaw, coreAssetName = undefined, decimals = 18, allowUndefinedBlock = true) { - const whitelist = whitelistRaw.map(t => t.toLowerCase()) - const coreAsset = coreAssetRaw.toLowerCase() - return async (timestamp, ethBlock, chainBlocks) => { - const block = await getBlock(timestamp, chain, chainBlocks, allowUndefinedBlock) - const transformAddress = await getChainTransform(chain) - - let pairAddresses; - const pairLength = (await sdk.api.abi.call({ - target: FACTORY, - abi: factoryAbi.allPairsLength, - chain, - block - })).output - if (pairLength === null) { - throw new Error("allPairsLength() failed") - } - const pairNums = Array.from(Array(Number(pairLength)).keys()) - { - const pairs = (await sdk.api.abi.multiCall({ - abi: factoryAbi.allPairs, - chain, - calls: pairNums.map(num => ({ - target: FACTORY, - params: [num] - })), - block - })).output - await requery(pairs, chain, block, factoryAbi.allPairs); - pairAddresses = pairs.map(result => result.output.toLowerCase()) - } - - const [token0Addresses, token1Addresses, reserves] = await Promise.all([ - sdk.api.abi - .multiCall({ - abi: token0, - chain, - calls: pairAddresses.map((pairAddress) => ({ - target: pairAddress, - })), - block, - }) - .then(({ output }) => output), - sdk.api.abi - .multiCall({ - abi: token1, - chain, - calls: pairAddresses.map((pairAddress) => ({ - target: pairAddress, - })), - block, - }) - .then(({ output }) => output), - sdk.api.abi - .multiCall({ - abi: getReserves, - chain, - calls: pairAddresses.map((pairAddress) => ({ - target: pairAddress, - })), - block, - }).then(({ output }) => output), - ]); - await requery(token0Addresses, chain, block, token0); - await requery(token1Addresses, chain, block, token1); - await requery(reserves, chain, block, getReserves); - - const pairs = {}; - // add token0Addresses - token0Addresses.forEach((token0Address) => { - const tokenAddress = token0Address.output.toLowerCase(); - - const pairAddress = token0Address.input.target.toLowerCase(); - pairs[pairAddress] = { - token0Address: tokenAddress, - } - }); - - // add token1Addresses - token1Addresses.forEach((token1Address) => { - const tokenAddress = token1Address.output.toLowerCase(); - const pairAddress = token1Address.input.target.toLowerCase(); - pairs[pairAddress] = { - ...(pairs[pairAddress] || {}), - token1Address: tokenAddress, - } - }); - - const balances = {} - let coreBalance = 0 - const prices = {} - for (let i = 0; i < reserves.length; i++) { - const pairAddress = reserves[i].input.target.toLowerCase(); - const pair = pairs[pairAddress]; - const token0Address = pair.token0Address.toLowerCase() - const token1Address = pair.token1Address.toLowerCase() - const reserveAmounts = reserves[i].output - if (token0Address === coreAsset) { - coreBalance += Number(reserveAmounts[0]) * 2 - if (whitelist.includes(token1Address)) { - setPrice(prices, token1Address, reserveAmounts[0], reserveAmounts[1]) - } - } else if (token1Address === coreAsset) { - coreBalance += Number(reserveAmounts[1]) * 2 - if (whitelist.includes(token0Address)) { - setPrice(prices, token0Address, reserveAmounts[1], reserveAmounts[0]) - } - } else { - const whitelistedToken0 = whitelist.find(t => t === token0Address) - const whitelistedToken1 = whitelist.find(t => t === token1Address) - if (whitelistedToken0 !== undefined) { - sum(balances, whitelistedToken0, Number(reserveAmounts[0]) * 2) - } else if (whitelistedToken1 !== undefined) { - sum(balances, whitelistedToken1, Number(reserveAmounts[1]) * 2) - } - } - } - const finalBalances = {} - Object.entries(balances).forEach(([address, amount]) => { - const price = prices[address]; - if (price !== undefined) { - coreBalance += price[1] * (amount ?? 0) - } else { - finalBalances[transformAddress(address)] = amount - } - }) - - const fixBalances = await getFixBalances(chain) - fixBalances(finalBalances) - - if (coreAssetName) - sdk.util.sumSingleBalance(finalBalances, coreAssetName, (coreBalance) / (10 ** decimals)) - else - sdk.util.sumSingleBalance(finalBalances, transformAddress(coreAsset), coreBalance) - - return finalBalances - } -}; - -// same as calculateUsdUniTvl, but takes pair addresses as params instead of iterating over all pairs from factory -function calculateUsdUniTvlPairs(pairAddresses, chain, coreAssetRaw, whitelistRaw, coreAssetName = undefined, decimals = 18, allowUndefinedBlock = true) { - const whitelist = whitelistRaw.map(t => t.toLowerCase()) - const coreAsset = coreAssetRaw.toLowerCase() - return async (timestamp, ethBlock, chainBlocks) => { - const block = await getBlock(timestamp, chain, chainBlocks, allowUndefinedBlock) - const transformAddress = await getChainTransform(chain) - - const [token0Addresses, token1Addresses, reserves] = await Promise.all([ - sdk.api.abi - .multiCall({ - abi: token0, - chain, - calls: pairAddresses.map((pairAddress) => ({ - target: pairAddress, - })), - block, - }) - .then(({ output }) => output), - sdk.api.abi - .multiCall({ - abi: token1, - chain, - calls: pairAddresses.map((pairAddress) => ({ - target: pairAddress, - })), - block, - }) - .then(({ output }) => output), - sdk.api.abi - .multiCall({ - abi: getReserves, - chain, - calls: pairAddresses.map((pairAddress) => ({ - target: pairAddress, - })), - block, - }).then(({ output }) => output), - ]); - await requery(token0Addresses, chain, block, token0); - await requery(token1Addresses, chain, block, token1); - await requery(reserves, chain, block, getReserves); - - const pairs = {}; - // add token0Addresses - token0Addresses.forEach((token0Address) => { - const tokenAddress = token0Address.output.toLowerCase(); - - const pairAddress = token0Address.input.target.toLowerCase(); - pairs[pairAddress] = { - token0Address: tokenAddress, - } - }); - - // add token1Addresses - token1Addresses.forEach((token1Address) => { - const tokenAddress = token1Address.output.toLowerCase(); - const pairAddress = token1Address.input.target.toLowerCase(); - pairs[pairAddress] = { - ...(pairs[pairAddress] || {}), - token1Address: tokenAddress, - } - }); - - const balances = {} - let coreBalance = 0 - const prices = {} - for (let i = 0; i < reserves.length; i++) { - const pairAddress = reserves[i].input.target.toLowerCase(); - const pair = pairs[pairAddress]; - const token0Address = pair.token0Address.toLowerCase() - const token1Address = pair.token1Address.toLowerCase() - const reserveAmounts = reserves[i].output - if (token0Address === coreAsset) { - coreBalance += Number(reserveAmounts[0]) * 2 - if (whitelist.includes(token1Address)) { - setPrice(prices, token1Address, reserveAmounts[0], reserveAmounts[1]) - } - } else if (token1Address === coreAsset) { - coreBalance += Number(reserveAmounts[1]) * 2 - if (whitelist.includes(token0Address)) { - setPrice(prices, token0Address, reserveAmounts[1], reserveAmounts[0]) - } - } else { - const whitelistedToken0 = whitelist.find(t => t === token0Address) - const whitelistedToken1 = whitelist.find(t => t === token1Address) - if (whitelistedToken0 !== undefined) { - sum(balances, whitelistedToken0, Number(reserveAmounts[0]) * 2) - } else if (whitelistedToken1 !== undefined) { - sum(balances, whitelistedToken1, Number(reserveAmounts[1]) * 2) - } - } - } - const finalBalances = {} - Object.entries(balances).forEach(([address, amount]) => { - const price = prices[address]; - if (price !== undefined) { - coreBalance += price[1] * (amount ?? 0) - } else { - finalBalances[transformAddress(address)] = amount - } - }) - - const fixBalances = await getFixBalances(chain) - fixBalances(finalBalances) - - if (coreAssetName) - sdk.util.sumSingleBalance(finalBalances, coreAssetName, (coreBalance) / (10 ** decimals)) - else - sdk.util.sumSingleBalance(finalBalances, transformAddress(coreAsset), coreBalance) - - return finalBalances - } -}; - -module.exports = { - calculateUsdUniTvl, - calculateUsdUniTvlPairs, - requery, - setPrice, - sum -}; diff --git a/src/adapters/peggedAssets/llama-helper/graph.js b/src/adapters/peggedAssets/llama-helper/graph.js deleted file mode 100644 index 606a39d9..00000000 --- a/src/adapters/peggedAssets/llama-helper/graph.js +++ /dev/null @@ -1,23 +0,0 @@ -const { GraphQLClient, } = require('graphql-request') - -async function blockQuery(endpoint, query, block, blockCatchupLimit = 200) { - const graphQLClient = new GraphQLClient(endpoint) - try { - const results = await graphQLClient.request(query, { block }) - return results - } catch (e) { - if (!block) throw e - const errorString = e.toString() - const isBlockCatchupIssue = /Failed to decode.*block.number.*has only indexed up to block number \d+/.test(errorString) - if (!isBlockCatchupIssue) throw e - const indexedBlockNumber = +errorString.match(/indexed up to block number (\d+) /)[1] - console.log('We have indexed only upto ', indexedBlockNumber, 'requested block: ', block) - if (block - blockCatchupLimit > indexedBlockNumber) - throw e - return graphQLClient.request(query, { block: indexedBlockNumber }) - } -} - -module.exports = { - blockQuery -} diff --git a/src/adapters/peggedAssets/llama-helper/hbar.js b/src/adapters/peggedAssets/llama-helper/hbar.js deleted file mode 100644 index 85919b26..00000000 --- a/src/adapters/peggedAssets/llama-helper/hbar.js +++ /dev/null @@ -1,22 +0,0 @@ -const http = require('./http') -const BigNumber = require('bignumber.js') -const sdk = require('@defillama/sdk') - -const HBAR_API_V1 = 'https://mainnet-public.mirrornode.hedera.com/api/v1' - -async function getHBARBalance(address, timestamp) { - const tsString = timestamp ? `×tamp=${timestamp}` : '' - const response = await http.get(`${HBAR_API_V1}/balances?account.id=${address}${tsString}`) - return response.balances[0].balance -} - -async function addHBarBalance({ balances = {}, address, timestamp }) { - let balance = await getHBARBalance(address, timestamp) - balance = BigNumber(balance).shiftedBy(-1 * 8).toFixed(0) - sdk.util.sumSingleBalance(balances, 'hedera-hashgraph', balance) - return balances -} - -module.exports = { - addHBarBalance -} \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/heroku-api.js b/src/adapters/peggedAssets/llama-helper/heroku-api.js deleted file mode 100644 index 45389f7b..00000000 --- a/src/adapters/peggedAssets/llama-helper/heroku-api.js +++ /dev/null @@ -1,28 +0,0 @@ -const utils = require('./utils') -const endpoint = "https://sushi-analytics.onrender.com/" -let _data - -function getExports(protocol, chains) { - const chainTvls = chains.reduce((obj, chain) => { - obj[chain === 'avax' ? 'avalanche' : chain] = { - tvl: async (timestamp) => { - if(Math.abs(Date.now()/1000-timestamp) > 3600){ - throw new Error("Can't refill adapters moved to heroku") - } - if (!_data) _data = utils.fetchURL(endpoint) - const data = await _data - if(data.data[protocol]?.[chain] === undefined){ - throw new Error(`Data for protocol ${protocol} on chain ${chain} is undefined on heroku`) - } - return data.data[protocol][chain] - } - } - return obj - }, {}) - - return chainTvls -} - -module.exports={ - getExports -} \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/historicalApi.js b/src/adapters/peggedAssets/llama-helper/historicalApi.js deleted file mode 100644 index cafa262c..00000000 --- a/src/adapters/peggedAssets/llama-helper/historicalApi.js +++ /dev/null @@ -1,26 +0,0 @@ -const { toUSDTBalances } = require('./balances') - -// getCurrent: ()=>number -// getHistorical: ()=>[{date, totalLiquidityUSD}] -async function getApiTvl(timestamp, getCurrent, getHistorical) { - if (Math.abs(timestamp - Date.now() / 1000) < 3600) { - const tvl = await getCurrent() - return toUSDTBalances(tvl) - } else { - const historical = await getHistorical() - let closest = historical[0] - historical.forEach(dayTvl => { - if (Math.abs(dayTvl.date - timestamp) < Math.abs(closest.date - timestamp)) { - closest = dayTvl - } - }) - if (Math.abs(closest.date - timestamp) > 3600 * 24) { // Oldest data is too recent - throw new Error("Too old") - } - return toUSDTBalances(closest.totalLiquidityUSD) - } -} - -module.exports = { - getApiTvl -} \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/hodltree/calculateBalances.js b/src/adapters/peggedAssets/llama-helper/hodltree/calculateBalances.js deleted file mode 100644 index b943a9da..00000000 --- a/src/adapters/peggedAssets/llama-helper/hodltree/calculateBalances.js +++ /dev/null @@ -1,54 +0,0 @@ -const sdk = require('@defillama/sdk'); - -const { - ethContracts, - polygonContracts, - dexTypes -} = require('../../config/hodltree'); -const { transformPolygonAddress, transformEthereumAddress } = require('../portedTokens'); -const { calculateEM } = require('./calculateEM'); -const { calculateFlashloan } = require('./calculateFlashloan'); -const { calculateLendBorrow } = require('./calculateLendBorrow'); - -async function calculateHodltreeBalances(dexes, chain, chainBlocks, transform) { - let tokenBalances = []; - for (let dex of dexes) { - let res; - switch (dex.dexType) { - case dexTypes.dexType.flashloan: - res = await calculateFlashloan(dex, chain, chainBlocks) - break - - case dexTypes.dexType.lendBorrow: - res = await calculateLendBorrow(dex, chain, chainBlocks) - break - - case dexTypes.dexType.em: - res = await calculateEM(dex, chain, chainBlocks) - break - } - tokenBalances = tokenBalances.concat(res); - } - const balances = {}; - tokenBalances.map((tokenBalancePair) => { - sdk.util.sumSingleBalance(balances, transform(tokenBalancePair[0]), tokenBalancePair[1]); - }) - - return balances; -} - -async function calculateHodltreeBalancesEth(timestamp, block, chainBlocks) { - const transform = await transformEthereumAddress(); - return calculateHodltreeBalances(ethContracts, 'ethereum', chainBlocks, transform); -} - -async function calculateHodltreeBalancesPolygon(timestamp, block, chainBlocks) { - const transform = await transformPolygonAddress() - return calculateHodltreeBalances(polygonContracts, 'polygon', chainBlocks, transform); - -} - -module.exports = { - calculateHodltreeBalancesEth, - calculateHodltreeBalancesPolygon -} \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/hodltree/calculateEM.js b/src/adapters/peggedAssets/llama-helper/hodltree/calculateEM.js deleted file mode 100644 index 7c93536a..00000000 --- a/src/adapters/peggedAssets/llama-helper/hodltree/calculateEM.js +++ /dev/null @@ -1,42 +0,0 @@ -const sdk = require('@defillama/sdk'); - -const erc20 = require("../abis/erc20.json"); - -/** - * @param {import("../../config/hodltree/addresses").Dex} dex - * @param {} chain - * @param {} chainBlocks - */ -async function calculateEM(dex, chain, chainBlocks) { - let tokens = []; - let calls = []; - dex.contracts.map((contract) => { - let token = contract.miscInfo.token; - tokens.push(token); - calls.push({ - target: token, - params: contract.address - }) - }) - - const flashloanBalances = ( - await sdk.api.abi.multiCall({ - abi: erc20.balanceOf, - calls, - chain: chain, - block: chainBlocks[chain], - }) - ).output.map((val) => val.output); - - let res = []; - - for (let tokenId = 0; tokenId < tokens.length; tokenId++) { - res.push([tokens[tokenId], flashloanBalances[tokenId]]); - } - - return res; -} - -module.exports = { - calculateEM -} \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/hodltree/calculateFlashloan.js b/src/adapters/peggedAssets/llama-helper/hodltree/calculateFlashloan.js deleted file mode 100644 index f6071983..00000000 --- a/src/adapters/peggedAssets/llama-helper/hodltree/calculateFlashloan.js +++ /dev/null @@ -1,43 +0,0 @@ -const sdk = require('@defillama/sdk'); - -const erc20 = require("../abis/erc20.json"); - -/** - * @param {import("../../config/hodltree/addresses").Dex} dex - * @param {} chain - * @param {} chainBlocks - */ -async function calculateFlashloan(dex, chain, chainBlocks) { - let tokens = []; - let calls = []; - dex.contracts.map((contract) => { - for (let token of contract.miscInfo.tokensIn) { - tokens.push(token); - calls.push({ - target: token, - params: contract.address - }) - } - }) - - const flashloanBalances = ( - await sdk.api.abi.multiCall({ - abi: erc20.balanceOf, - calls, - chain: chain, - block: chainBlocks[chain], - }) - ).output.map((val) => val.output); - - let res = []; - - for (let tokenId = 0; tokenId < tokens.length; tokenId++) { - res.push([tokens[tokenId], flashloanBalances[tokenId]]); - } - - return res; -} - -module.exports = { - calculateFlashloan -} \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/hodltree/calculateLendBorrow.js b/src/adapters/peggedAssets/llama-helper/hodltree/calculateLendBorrow.js deleted file mode 100644 index fd903526..00000000 --- a/src/adapters/peggedAssets/llama-helper/hodltree/calculateLendBorrow.js +++ /dev/null @@ -1,45 +0,0 @@ -const sdk = require('@defillama/sdk'); -const erc20 = require("../abis/erc20.json"); -const { - dexTypes -} = require('../../config/hodltree'); - -/** - * @param {import("../../config/hodltree/addresses").Dex} dex - * @param {} chain - * @param {} chainBlocks - */ -async function calculateLendBorrow(dex, chain, chainBlocks) { - let calls = []; - let tokens = []; - - dex.contracts.map((contract) => { - let token = contract.miscInfo.tokenIn; - tokens.push(token); - calls.push({ - target: token, - params: contract.address - }); - }); - - const lendBorrowBalances = ( - await sdk.api.abi.multiCall({ - abi: erc20.balanceOf, - calls, - chain: chain, - block: chainBlocks[chain], - }) - ).output.map((val) => val.output); - - let res = []; - - for (let tokenId = 0; tokenId < tokens.length; tokenId++) { - res.push([tokens[tokenId], lendBorrowBalances[tokenId]]); - } - - return res; -} - -module.exports = { - calculateLendBorrow -} \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/hodltree/index.js b/src/adapters/peggedAssets/llama-helper/hodltree/index.js deleted file mode 100644 index e69de29b..00000000 diff --git a/src/adapters/peggedAssets/llama-helper/koyo.js b/src/adapters/peggedAssets/llama-helper/koyo.js deleted file mode 100644 index 92727781..00000000 --- a/src/adapters/peggedAssets/llama-helper/koyo.js +++ /dev/null @@ -1,98 +0,0 @@ -const sdk = require("@defillama/sdk"); -const { requery } = require("./requery"); -const { fetchURL } = require("./utils"); -const BigNumber = require("bignumber.js"); -const { usdtAddress, toUSDT } = require("./balances"); - -const koyoStableSwapVirtualPriceABI = { - stateMutability: "view", - type: "function", - name: "get_virtual_price", - inputs: [], - outputs: [ - { - name: "", - type: "uint256", - }, - ], -}; - -/** - * @description This function presumes that passed LP Tokens are from USD based stable pools. - * @param {Object.} balances - * @param {string[]} lpTokens - * @param {string[]} owners - * @param {number[]} block - * @param {string} [chain="boba"] - * @param {*} transformAddress - */ -async function sumKoyoLPTokens( - balances, - lpTokens, - owners, - block, - chain = "boba", - transformAddress = (addr) => addr -) { - const { - data: { data: pools }, - } = await fetchURL(`https://api.exchange.koyo.finance/pools/raw/${chain}`); - const lpToSwap = Object.fromEntries( - Object.entries(pools) - .filter(([k]) => !["generatedTime"].includes(k)) - .map(([, pool]) => - [pool.addresses.lpToken, pool.addresses.swap].map((addr) => - addr.toLowerCase() - ) - ) - ); - - const swapCalls = Object.values(lpToSwap).map((swap) => ({ - target: swap, - })); - const virtualPrices = await sdk.api.abi.multiCall({ - block, - abi: koyoStableSwapVirtualPriceABI, - calls: swapCalls, - chain, - }); - - const balanceOfTokens = await sdk.api.abi.multiCall({ - calls: lpTokens - .map((target) => - owners.map((o) => ({ - target, - params: o, - })) - ) - .flat(), - abi: "erc20:balanceOf", - block, - chain, - }); - - await requery(balanceOfTokens, chain, block, "erc20:balanceOf"); - - balanceOfTokens.output.forEach((result) => { - const token = result.input.target.toLowerCase(); - const balance = result.output; - - const virtualPrice = virtualPrices.output.find( - (call) => call.input.target === lpToSwap[token] - ).output; - - const virtualizedBalance = BigNumber(balance).times( - BigNumber(virtualPrice).div(10 ** 18) - ); - - sdk.util.sumSingleBalance( - balances, - usdtAddress, - toUSDT(virtualizedBalance.div(10 ** 18)) - ); - }); -} - -module.exports = { - sumKoyoLPTokens, -}; diff --git a/src/adapters/peggedAssets/llama-helper/liquity.js b/src/adapters/peggedAssets/llama-helper/liquity.js deleted file mode 100644 index 9c0cd6ac..00000000 --- a/src/adapters/peggedAssets/llama-helper/liquity.js +++ /dev/null @@ -1,36 +0,0 @@ -const sdk = require("@defillama/sdk"); -const getEntireSystemCollAbi = require("./abis/getEntireSystemColl.abi.json"); - -const TUSD = "0x0000000000085d4780b73119b644ae5ecd22b376" - -function getLiquityTvl(ETH_ADDRESS, TROVE_MANAGER_ADDRESS, chain) { - return async (_, ethBlock, chainBlocks) => { - const block = chainBlocks[chain] - /*const stabilityPoolLusdTvl = ( - await sdk.api.erc20.balanceOf({ - target: LUSD_TOKEN_ADDRESS, - owner: STABILITY_POOL_ADDRESS, - block, - chain, - }) - ).output;*/ - - const troveEthTvl = ( - await sdk.api.abi.call({ - target: TROVE_MANAGER_ADDRESS, - abi: getEntireSystemCollAbi, - block, - chain, - }) - ).output; - - return { - [chain+':'+ETH_ADDRESS]: troveEthTvl, - //[useTusd? TUSD : chain+':'+LUSD_TOKEN_ADDRESS]: stabilityPoolLusdTvl, - }; - } -} - -module.exports = { - getLiquityTvl -}; diff --git a/src/adapters/peggedAssets/llama-helper/masterchef.js b/src/adapters/peggedAssets/llama-helper/masterchef.js deleted file mode 100644 index 8f9ace61..00000000 --- a/src/adapters/peggedAssets/llama-helper/masterchef.js +++ /dev/null @@ -1,336 +0,0 @@ -const sdk = require('@defillama/sdk'); -const abi = require('./abis/masterchef.json') -const { unwrapUniswapLPs, unwrapLPsAuto, isLP } = require('./unwrapLPs') -const tokenAbi = require("./abis/token.json"); -const token0Abi = require("./abis/token0.json"); -const token1Abi = require("./abis/token1.json"); -const getReservesAbi = require("./abis/getReserves.json"); -const userInfoAbi = require("./abis/userInfo.json"); -const { getBlock } = require('./getBlock'); -const { default: BigNumber } = require('bignumber.js'); -const { getChainTransform, getFixBalances } = require('../helper/portedTokens'); - -async function getPoolInfo(masterChef, block, chain, poolInfoAbi = abi.poolInfo) { - const poolLength = ( - await sdk.api.abi.call({ - abi: abi.poolLength, - target: masterChef, - block, - chain, - }) - ).output; - - const poolInfo = ( - await sdk.api.abi.multiCall({ - block, - calls: Array.from(Array(Number(poolLength)).keys()).map(i => ({ - target: masterChef, - params: i, - })), - abi: poolInfoAbi, - chain, - }) - ).output; - - return poolInfo -} - -async function getSymbolsAndBalances(masterChef, block, chain, poolInfo) { - const [symbols, tokenBalances] = await Promise.all([ - sdk.api.abi.multiCall({ - block, - calls: poolInfo.map(p => ({ - target: p.output[0] - })), - abi: 'erc20:symbol', - chain, - }), - sdk.api.abi.multiCall({ - block, - calls: poolInfo.map(p => ({ - target: p.output[0], - params: masterChef - })), - abi: 'erc20:balanceOf', - chain, - }) - ]) - return [symbols, tokenBalances] -} - -function isYV(symbol) { - return symbol.includes('yv') -} - -async function addFundsInMasterChef(balances, masterChef, block, chain = 'ethereum', transformAddress = undefined, poolInfoAbi = abi.poolInfo, ignoreAddresses = [], includeLPs = true, excludePool2 = false, stakingToken = undefined) { - const poolInfo = await getPoolInfo(masterChef, block, chain, poolInfoAbi) - if (!transformAddress) transformAddress = await getChainTransform(chain) - const [symbols, tokenBalances] = await getSymbolsAndBalances(masterChef, block, chain, poolInfo); - - const lpPositions = []; - const lpTokens = []; - - symbols.output.forEach((symbol, idx) => { - const balance = tokenBalances.output[idx].output; - const token = symbol.input.target; - if (ignoreAddresses.some(addr => addr.toLowerCase() === token.toLowerCase()) || symbol.output === null) { - return - } - if (isLP(symbol.output, symbol.input.target, chain)) { - if (includeLPs && balance && !excludePool2) { - lpPositions.push({ - balance, - token - }); - } - else if (includeLPs && balance && excludePool2) { - lpTokens.push(token); - } - } else { - sdk.util.sumSingleBalance(balances, transformAddress(token), balance) - } - }) - - if (excludePool2) { - const [token0, token1, balance] = await Promise.all([ - sdk.api.abi.multiCall({ - calls: lpTokens.map(p => ({ - target: p - })), - abi: token0Abi, - block, - chain - }), - sdk.api.abi.multiCall({ - calls: lpTokens.map(p => ({ - target: p - })), - abi: token1Abi, - block, - chain - }), - sdk.api.abi.multiCall({ - calls: lpTokens.map(p => ({ - target: p, - params: masterChef - })), - abi: "erc20:balanceOf", - block, - chain - }) - ]); - - [token0, token1, balance].forEach((_, idx) => { - if (lpTokens[idx] === undefined || token0.output[idx].output.toLowerCase() === stakingToken.toLowerCase() || token1.output[idx].output.toLowerCase() === stakingToken.toLowerCase()) { - return - } - lpPositions.push({ - balance: balance.output[idx].output, - token: balance.output[idx].input.target - }); - }); - } - - - await unwrapUniswapLPs( - balances, - lpPositions, - block, - chain, - transformAddress - ); -} - -function masterChefExports(masterChef, chain, stakingTokenRaw, tokenIsOnCoingecko = true, poolInfoAbi = abi.poolInfo, includeYVTokens = false) { - const stakingToken = stakingTokenRaw.toLowerCase(); - let balanceResolve; - - async function getTvl(timestamp, ethBlock, chainBlocks) { - const block = await getBlock(timestamp, chain, chainBlocks, true) - const transformAddress = await getChainTransform(chain); - - const poolInfo = await getPoolInfo(masterChef, block, chain, poolInfoAbi) - const [symbols, tokenBalances] = await getSymbolsAndBalances(masterChef, block, chain, poolInfo); - - const balances = { - staking: {}, - pool2: {}, - tvl: {} - } - - const lpPositions = []; - - await Promise.all(symbols.output.map(async (symbol, idx) => { - const balance = tokenBalances.output[idx].output; - const token = symbol.input.target.toLowerCase(); - if (token === stakingToken) { - sdk.util.sumSingleBalance(balances.staking, transformAddress(token), balance) - } else if (isLP(symbol.output, symbol.input.target, chain)) { - lpPositions.push({ - balance, - token - }); - } else if (includeYVTokens && isYV(symbol.output)) { - let underlyingToken = (await sdk.api.abi.call({ - target: token, - abi: tokenAbi, - block, - chain, - })).output; - sdk.util.sumSingleBalance(balances.tvl, transformAddress(underlyingToken), balance) - } else { - sdk.util.sumSingleBalance(balances.tvl, transformAddress(token), balance) - } - })); - - const [token0, token1] = await Promise.all([ - sdk.api.abi.multiCall({ - calls: lpPositions.map(p => ({ - target: p.token - })), - abi: token0Abi, - block, - chain - }), - sdk.api.abi.multiCall({ - calls: lpPositions.map(p => ({ - target: p.token - })), - abi: token1Abi, - block, - chain - }), - ]); - - const pool2LpPositions = [] - const outsideLpPositions = [] - lpPositions.forEach((position, idx) => { - if (token0.output[idx].output.toLowerCase() === stakingToken || token1.output[idx].output.toLowerCase() === stakingToken) { - pool2LpPositions.push(position); - } else { - outsideLpPositions.push(position); - } - }) - await Promise.all([unwrapUniswapLPs( - balances.tvl, - outsideLpPositions, - block, - chain, - transformAddress - ), unwrapUniswapLPs( - balances.pool2, - pool2LpPositions, - block, - chain, - transformAddress - )]); - - if (!tokenIsOnCoingecko && pool2LpPositions.length) { - const response = (await sdk.api.abi.multiCall({ - calls: pool2LpPositions.map(p => ({ - target: stakingToken, - params: [p.token] - })), - abi: "erc20:balanceOf", - block, - chain - })).output - const maxPool2ByToken = response.reduce((max, curr) => { - if (BigNumber(curr.output).gt(max.output)) { - return curr - } - return max - }); - const poolAddress = maxPool2ByToken.input.params[0].toLowerCase() - const poolReserves = await sdk.api.abi.call({ - block, - chain, - abi: getReservesAbi, - target: poolAddress - }) - const posToken0 = token0.output.find(t => t.input.target.toLowerCase() === poolAddress).output; - const posToken1 = token1.output.find(t => t.input.target.toLowerCase() === poolAddress).output; - let price, otherToken; - if (posToken0.toLowerCase() === stakingToken) { - price = poolReserves.output[1] / poolReserves.output[0] - otherToken = transformAddress(posToken1) - } else { - price = poolReserves.output[0] / poolReserves.output[1] - otherToken = transformAddress(posToken0) - } - const transformedStakingToken = transformAddress(stakingToken) - Object.values(balances).forEach(balance => { - Object.entries(balance).forEach(([addr, bal]) => { - if (addr.toLowerCase() === transformedStakingToken) { - balance[otherToken] = BigNumber(bal).times(price).toFixed(0) - delete balance[addr] - } - }) - }) - } - - if (['smartbch', 'cronos'].includes(chain)) { - const fixBalances = await getFixBalances(chain) - Object.values(balances).map(fixBalances) - } - return balances - }; - - function getTvlPromise(key) { - return async (ts, _block, chainBlocks) => { - if (!balanceResolve) - balanceResolve = getTvl(ts, _block, chainBlocks) - return (await balanceResolve)[key] - } - } - - return { - methodology: "TVL includes all farms in MasterChef contract", - [chain]: { - staking: getTvlPromise("staking"), - pool2: getTvlPromise("pool2"), - masterchef: getTvlPromise("tvl"), - tvl: getTvlPromise("tvl"), - } - }; -} - -const standardPoolInfoAbi = { "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "name": "poolInfo", "outputs": [{ "internalType": "contract IERC20", "name": "lpToken", "type": "address" }, { "internalType": "uint256", "name": "allocPoint", "type": "uint256" }, { "internalType": "uint256", "name": "lastRewardBlock", "type": "uint256" }, { "internalType": "uint256", "name": "accWeVEPerShare", "type": "uint256" }], "stateMutability": "view", "type": "function" } - -async function getUserMasterChefBalances({ balances = {}, masterChefAddress, userAddres, block, chain = 'ethereum', transformAddress, excludePool2 = false, onlyPool2 = false, pool2Tokens= [], poolInfoABI = abi.poolInfo }) { - if (!transformAddress) - transformAddress = await getChainTransform(chain) - - const tempBalances = {} - const poolLength = (await sdk.api.abi.call({ abi: abi.poolLength, target: masterChefAddress, block, chain, })).output - const dummyArray = Array.from(Array(Number(poolLength)).keys()) - const poolInfoCalls = dummyArray.map(i => ({ target: masterChefAddress, params: i, })) - const userInfoCalls = dummyArray.map(i => ({ target: masterChefAddress, params: [i, userAddres], })) - const lpTokens = (await sdk.api.abi.multiCall({ block, calls: poolInfoCalls, abi: poolInfoABI, chain, })).output - .map(a => a.output && a.output[0]) - const userBalances = (await sdk.api.abi.multiCall({ block, calls: userInfoCalls, abi: userInfoAbi, chain, })).output - .map(a => a.output[0]) - - userBalances.forEach((balance, idx) => { - if (isNaN(+balance) || +balance <= 0) return; - tempBalances[transformAddress(lpTokens[idx])] = balance - }) - - await unwrapLPsAuto({ balances: tempBalances, chain, block, transformAddress, excludePool2, onlyPool2, pool2Tokens }) - - Object.keys(tempBalances).forEach(key => sdk.util.sumSingleBalance(balances, key, tempBalances[key])) - - return balances -} - - -module.exports = { - addFundsInMasterChef, - masterChefExports, - getPoolInfo, - isLP, - standardPoolInfoAbi, - getSymbolsAndBalances, - isYV, - getUserMasterChefBalances, -} diff --git a/src/adapters/peggedAssets/llama-helper/methodologies.js b/src/adapters/peggedAssets/llama-helper/methodologies.js deleted file mode 100644 index a10038dd..00000000 --- a/src/adapters/peggedAssets/llama-helper/methodologies.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = { - lendingMarket : "Counts the tokens locked in the contracts to be used as collateral to borrow or to earn yield. Borrowed coins are not counted towards the TVL, so only the coins actually locked in the contracts are counted. There's multiple reasons behind this but one of the main ones is to avoid inflating the TVL through cycled lending.", -} \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/near.js b/src/adapters/peggedAssets/llama-helper/near.js deleted file mode 100644 index fa9e1527..00000000 --- a/src/adapters/peggedAssets/llama-helper/near.js +++ /dev/null @@ -1,137 +0,0 @@ -const axios = require("axios"); -const { default: BigNumber } = require("bignumber.js"); -const { transformNearAddress } = require("./portedTokens"); -const sdk = require("@defillama/sdk"); - -const transformAddress = transformNearAddress(); - -const endpoint = "https://rpc.mainnet.near.org"; - -const tokenMapping = { - "wrap.near": { name: "near", decimals: 24 }, - "meta-pool.near": { name: "staked-near", decimals: 24 }, - "linear-protocol.near": { name: "linear-protocol", decimals: 24 }, - usn: { name: "usn", decimals: 18 }, - aurora: { name: "ethereum", decimals: 18 }, - "token.skyward.near": { name: "skyward-finance", decimals: 18 }, - "dbio.near": { name: "debio-network", decimals: 18 }, - // 'hak.tkn.near': { name: '', }, // Hakuna matata - "meta-token.near": { name: "meta-near", decimals: 24 }, - "v3.oin_finance.near": { name: "oin-finance", decimals: 8 }, - // 'gems.l2e.near': { name: '', }, // https://www.landtoempire.com/ - // 'nd.tkn.near': { name: '', }, // nearDog - // 'gold.l2e.near': { name: '', }, // https://www.landtoempire.com/ - "token.v2.ref-finance.near": { name: "ref-finance", decimals: 18 }, - // 'myriadcore.near': { name: '', }, // Myria - "6b175474e89094c44da98b954eedeac495271d0f.factory.bridge.near": { - name: "dai", - decimals: 18, - }, - "a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48.factory.bridge.near": { - name: "usd-coin", - decimals: 6, - }, - "dac17f958d2ee523a2206206994597c13d831ec7.factory.bridge.near": { - name: "tether", - decimals: 6, - }, - "2260fac5e5542a773aa44fbcfedf7c193bc2c599.factory.bridge.near": { - name: "wrapped-bitcoin", - decimals: 8, - }, - "aaaaaa20d9e0e2461697782ef11675f668207961.factory.bridge.near": { - name: "aurora-near", - decimals: 18, - }, - "token.burrow.near": { name: "burrow", decimals: 18 }, - "token.paras.near": { name: "paras", decimals: 18 }, - "token.pembrock.near": { name: "pembrock", decimals: 18 }, - "17208628f84f5d6ad33f0da3bbbeb27ffcb398eac501a31bd6ad2011e36133a1": { - name: "usd-coin", - decimals: 6, - }, - "usdt.tether-token.near": { - name: "tether", - decimals: 6, - }, -}; - -async function view_account(account_id) { - const result = await axios.post(endpoint, { - jsonrpc: "2.0", - id: "1", - method: "query", - params: { - request_type: "view_account", - finality: "final", - account_id: account_id, - }, - }); - if (result.data.error) { - throw new Error(`${result.data.error.message}: ${result.data.error.data}`); - } - return result.data.result; -} - -async function call(contract, method, args = {}) { - const result = await axios.post(endpoint, { - jsonrpc: "2.0", - id: "1", - method: "query", - params: { - request_type: "call_function", - finality: "final", - account_id: contract, - method_name: method, - args_base64: Buffer.from(JSON.stringify(args)).toString("base64"), - }, - }); - if (result.data.error) { - throw new Error(`${result.data.error.message}: ${result.data.error.data}`); - } - return JSON.parse(Buffer.from(result.data.result.result).toString()); -} - -async function getTokenBalance(token, account) { - return call(token, "ft_balance_of", { account_id: account }); -} - -async function addTokenBalances(tokens, account, balances = {}) { - if (!Array.isArray(tokens)) tokens = [tokens]; - const fetchBalances = tokens.map((token) => - addAsset(token, account, balances) - ); - await Promise.all(fetchBalances); - return balances; -} - -async function addAsset(token, account, balances = {}) { - let balance = await getTokenBalance(token, account); - return sumSingleBalance(balances, token, balance); -} - -function sumSingleBalance(balances, token, balance) { - const { name, decimals } = tokenMapping[token] || {}; - - if (name) { - if (decimals) balance = balance / 10 ** decimals; - - balances[name] = BigNumber(+(balances[name] || 0) + balance).toFixed(0); - return; - } - - sdk.util.sumSingleBalance( - balances, - transformAddress(token), - BigNumber(balance).toFixed(0) - ); - return balances; -} - -module.exports = { - view_account, - call, - addTokenBalances, - getTokenBalance, - sumSingleBalance, -}; diff --git a/src/adapters/peggedAssets/llama-helper/obyte.js b/src/adapters/peggedAssets/llama-helper/obyte.js deleted file mode 100644 index 6b26a00d..00000000 --- a/src/adapters/peggedAssets/llama-helper/obyte.js +++ /dev/null @@ -1,250 +0,0 @@ -const utils = require('./utils') - -/** - * @param {number} timestamp - unix timestamp in seconds from epoch of the moment in time for which the balances are requested - * @param {string} address - the Obyte address of the base AA for which the balances are fetched - * - * @return {Promise} the balances of all assets of all AAs that are based on the base AA identified by address - */ -async function fetchBaseAABalances(timestamp, address) { - /* - * { - * "subject": "GS23D3GQNNMNJ5TL4Z5PINZ5626WASMA", - * "addresses": { - * "67XYBBBME57DZMJPLOYNXSIMAIDHGUDW": { - * "assets": { - * "3XF+1slNoFxIVPvRupR5uf9AXluOm92nobzKyCCSE3c=": { - * "balance": 829, - * "burned": false, - * "selfIssued": false, - * "selfIssuedUncapped": false - * }, - * "base": { - * "balance": 36262, - * "burned": false, - * "selfIssued": false, - * "selfIssuedUncapped": false - * } - * } - * }, - * "TBLLH5DGDX6KU5UGHG4WDH4N7IC5FPKP": { - * ... - * }, - * } - * } - */ - const fetched = await utils.fetchURL(` https://api.charts.obyte.app/baseagents/${address}/balances?ts=${timestamp}`) - return fetched.data -} - -/** - * A reducer applied on a list of response objects returned by fetchBaseAABalances() to calculate the total. - * This reducer excludes locked in assets that were issued by the same autonomous agent. - * - * @example - * const balancesV1 = wait fetchBaseAABalances(timestamp, 'GS23D3GQNNMNJ5TL4Z5PINZ5626WASMA') - * const balancesV2 = wait fetchBaseAABalances(timestamp, '2JYYNOSRFGLI3TBI4FVSE6GFBUAZTTI3') - * const tvl = [balancesV1, balancesV2].reduce(summingBaseAABalancesToTvl(assetMetadata, exchangeRates), 0) - * - * @param {object} assetMetadata asset metadata (eg. decimals) mapped to the asset id (asset unit hash) - * @param {object} exchangeRates asset/USD exchange rates mapped to assetId_USD keys - * @return {function(number, object)} reducer function to be used with Array.reduce() where each element in the array is - * a result of a fetchBaseAABalances() call - */ -function summingBaseAABalancesToTvl(assetMetadata, exchangeRates) { - - const summingAssetTvl = (total, [asset, assetDetails]) => { - if (!assetMetadata?.hasOwnProperty(asset)) return total - - const decimals = assetMetadata[asset].decimals ?? 0 - const baseCurrency = (asset === "base") ? "GBYTE" : asset - const usdRate = exchangeRates[`${baseCurrency}_USD`] ?? 0 - const usdValue = assetDetails.balance / Math.pow(10, decimals) * usdRate - // console.log(` ${assetMetadata[asset]?.symbol ?? asset} = ${usdValue.toFixed(2)}`) - return total + usdValue - } - - const summingAddressTvl = (total, [address, addressDetails]) => { - // console.log(`${address}:`) - return total + Object.entries(addressDetails.assets) - .filter(([asset, assetDetails]) => !assetDetails.selfIssued) - .reduce(summingAssetTvl, 0) - } - - const summingBaseAATvl = (total, balances) => { - return total + Object.entries(balances.addresses).reduce(summingAddressTvl, 0) - } - - return summingBaseAATvl -} - -/** - * @return {Promise} fetches all exchange rates traded on Oswap v1 and v2 plus a few externally defined tokens such as GBYTE-USD or BTC-USD - */ -async function fetchOswapExchangeRates() { - /* - * { - * "BTC_USD": 29832, - * "GBYTE_BTC": 0.0004509, - * "GBYTE_USD": 13.4512488, - * "+X9n1ni9OpH/0PFXdmeB4f16wSxSivW4/qcyOt1UEDI=_USD": 88.2777158012621, - * "/1ReF/OW7wud1rqomgWMSeaetx8WjyD6eSTnGurTftU=_USD": 0.22874160911121644 - * } - */ - const fetched = await utils.fetchURL("https://v2-data.oswap.io/api/v1/exchangeRates") - return fetched.data -} - -/** - * @return {Promise} fetches assets traded on Oswap v1 - */ -async function fetchOswapV1Assets() { - /* - * { - * "O2-GBYTE-USDC": { - * "asset_id": "cQZVAFFh0Aaj5kMMydWoTqcMDxpfzGzEZhhEaQSVbHA=", - * "decimals": 0, - * "description": "Oswap v2 LP shares GBYTE-USDC", - * "symbol": "O2-GBYTE-USDC", - * "supply": 5026551 - * } - * } - */ - const fetched = await utils.fetchURL("https://v1-data.oswap.io/api/v1/assets") - const assets = fetched.data - return Object.values(assets).reduce((map, asset) => { - map[asset.asset_id] = asset - return map - }, {}) -} - -/** - * @return {Promise} fetches assets traded on Oswap v2 - */ -async function fetchOswapV2Assets() { - /* - * { - * "O2-GBYTE-USDC": { - * "asset_id": "cQZVAFFh0Aaj5kMMydWoTqcMDxpfzGzEZhhEaQSVbHA=", - * "decimals": 0, - * "description": "Oswap v2 LP shares GBYTE-USDC", - * "symbol": "O2-GBYTE-USDC", - * "supply": 5026551 - * } - * } - */ - const fetched = await utils.fetchURL("https://v2-data.oswap.io/api/v1/assets") - const assets = fetched.data - return Object.values(assets).reduce((map, asset) => { - map[asset.asset_id] = asset - return map - }, {}) -} - -async function fetchOswapAssets() { - const [assets1, assets2] = await Promise.all([ - fetchOswapV1Assets(), - fetchOswapV2Assets() - ]) - return { - ...assets1, - ...assets2 - } -} - -/** - * @return {Promise} fetches assets traded on Oswap v2 - */ -async function fetchOstableAssets() { - /* - * { - * "IUSD": { - * "asset_id": "eCpmov+r6LOVNj8KD0EWTyfKPrqsG3i2GgxV4P+zE6A=", - * "decimals": 4, - * "description": "Stable+ token for bonded stablecoin (VLKI3XMMX5YULOBA6ZXBXDPI6TXF6V3D)", - * "symbol": "IUSD", - * "supply": 61172.4893, - * "last_gbyte_value": 0.08233341192937123 - * }, - * } - */ - const fetched = await utils.fetchURL("https://data.ostable.org/api/v1/assets") - const assets = fetched.data - return Object.values(assets).reduce((map, asset) => { - map[asset.asset_id] = asset - return map - }, {}) -} - -/** - * Exchange rates of assets traded on Ostable. - * @example - * { - * { "ymCWKx3kZg06i9oG5c1n3K+BdsCz4uE32hZ94sT3CsU=_base": 2.91381565819933e-06 } - * } - * - * @return {Promise} map of asset pairs issued on Ostable to their exchange rate. - */ -async function fetchOstableExchangeRates() { - /* - * { - * { - * "market_name": "GB2S-GBYTE", - * "quote_symbol": "GBYTE", - * "base_symbol": "GB2S", - * "quote_id": "base", - * "base_id": "ymCWKx3kZg06i9oG5c1n3K+BdsCz4uE32hZ94sT3CsU=", - * "lowest_price_24h": 0, - * "highest_price_24h": 0, - * "last_price": 2.91381565819933e-06, - * "quote_volume": 0, - * "base_volume": 0, - * "first_trade_date": "2020-10-09T10:26:11.000Z" - * } - * } - */ - - const fetched = await utils.fetchURL("https://data.ostable.org/api/v1/tickers") - const tickers = fetched.data - return Object.values(tickers).reduce((map, ticker) => { - const currencyPair = `${ticker.base_id}_${ticker.quote_id}` - map[currencyPair] = ticker.last_price - return map - }, {}) -} - -/** - * Exchange rates of assets in USD traded on Ostable. - * @example - * { - * { "ymCWKx3kZg06i9oG5c1n3K+BdsCz4uE32hZ94sT3CsU=_USD": 42.12 } - * } - * - * @return {Promise} map of asset pairs issued on Ostable to their exchange rate in USD. - */ -async function fetchOstableExchangeRatesInUSD() { - const [oswapRates, ostableRates] = await Promise.all([ - fetchOswapExchangeRates(), - fetchOstableExchangeRates() - ]) - - const gbyteUsd = oswapRates["GBYTE_USD"] - - const ostableRatesInUSD = Object.entries(ostableRates) - .filter(([currencyPair, price]) => currencyPair.endsWith("_base")) - .reduce((map, [currencyPair, price]) => ({...map, [currencyPair.replace("_base", "_USD")]: price * gbyteUsd})) - - return { - "GBYTE_USD": gbyteUsd, - ...ostableRatesInUSD - } -} - -module.exports = { - fetchBaseAABalances, - fetchOswapExchangeRates, - fetchOswapAssets, - fetchOstableAssets, - fetchOstableExchangeRatesInUSD, - summingBaseAABalancesToTvl -} diff --git a/src/adapters/peggedAssets/llama-helper/ohm.js b/src/adapters/peggedAssets/llama-helper/ohm.js deleted file mode 100644 index 9c707f2f..00000000 --- a/src/adapters/peggedAssets/llama-helper/ohm.js +++ /dev/null @@ -1,33 +0,0 @@ -const { staking, stakingUnknownPricedLP } = require('./staking') -const { sumTokensAndLPsSharedOwners, sumLPWithOnlyOneTokenOtherThanKnown } = require('./unwrapLPs') -const { getFixBalances } = require('./portedTokens') - -function ohmTvl(treasury, treasuryTokens, chain = 'ethereum', stakingAddress, stakingToken, transformOriginal = undefined, fix, tokenOnCoingecko = true) { - let transform = transformOriginal - const tvl = async (time, ethBlock, chainBlocks) => { - const block = chainBlocks[chain] - const balances = {} - await sumTokensAndLPsSharedOwners(balances, tokenOnCoingecko?treasuryTokens:treasuryTokens.filter(t=>t[1]===false), [treasury], block, chain, transform || (addr => `${chain}:${addr}`)) - if(!tokenOnCoingecko){ - await Promise.all(treasuryTokens.filter(t=>t[1]===true).map(t=> - sumLPWithOnlyOneTokenOtherThanKnown(balances, t[0], treasury, stakingToken, block, chain, transform) - )) - } - if (!fix) fix = await getFixBalances(chain) - fix(balances) - return balances - } - return { - [chain === "avax"?"avalanche":chain]: { - tvl, - staking: tokenOnCoingecko? - staking(stakingAddress, stakingToken, chain, transform ? transform(stakingToken) : undefined) - : stakingUnknownPricedLP(stakingAddress, stakingToken, chain, treasuryTokens.find(t=>t[1]===true)[0], transform) - } - } -} - -module.exports = { - ohmTvl -} - diff --git a/src/adapters/peggedAssets/llama-helper/pact.js b/src/adapters/peggedAssets/llama-helper/pact.js deleted file mode 100644 index 76e20e42..00000000 --- a/src/adapters/peggedAssets/llama-helper/pact.js +++ /dev/null @@ -1,27 +0,0 @@ -const { post } = require('./http') -const { prepareExecCmd } = require('./utils/pact') - -async function fetchLocal(localCmd, apiHost) { - if (!apiHost) throw new Error(`Pact.fetch.local(): No apiHost provided`); - - const { pactCode, meta, networkId } = localCmd - const cmd = prepareExecCmd(pactCode, meta, networkId); - const res = await post(`${apiHost}/api/v1/local`, cmd) - return res; -} - -function mkMeta(sender, chainId, gasPrice, gasLimit, creationTime, ttl) { - return { - creationTime: creationTime, - ttl: ttl, - gasLimit: gasLimit, - chainId: chainId, - gasPrice: gasPrice, - sender: sender - }; -} - -module.exports = { - fetchLocal, - mkMeta, -} \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/pool2.js b/src/adapters/peggedAssets/llama-helper/pool2.js deleted file mode 100644 index ab037f92..00000000 --- a/src/adapters/peggedAssets/llama-helper/pool2.js +++ /dev/null @@ -1,156 +0,0 @@ -const {_BASE_TOKEN_, _QUOTE_TOKEN_} = require('./abis/dodo.json') -const sdk = require('@defillama/sdk') -const { default: BigNumber } = require('bignumber.js') -const { unwrapUniswapLPs, sumTokensAndLPsSharedOwners, sumTokensAndLPs } = require('./unwrapLPs'); -const masterchefAbi = require("./abis/masterchef.json") -const token0Abi = require("./abis/token0.json") -const token1Abi = require("./abis/token1.json") -const {isLP, getPoolInfo} = require('./masterchef') - -function pool2(stakingContract, lpToken, chain = "ethereum", transformAddress) { - return async (_timestamp, _ethBlock, chainBlocks) => { - const balances = {} - if(transformAddress === undefined){ - transformAddress = addr=>`${chain}:${addr}` - } - await sumTokensAndLPs(balances, [[lpToken, stakingContract, true]], chainBlocks[chain], chain, transformAddress) - return balances - } -} - -function pool2s(stakingContracts, lpTokens, chain = "ethereum", transformAddress = undefined){ - return async (_timestamp, _ethBlock, chainBlocks) => { - const balances = {} - let transform = transformAddress - if(transform === undefined){ - transform = addr=>`${chain}:${addr}` - } - await sumTokensAndLPsSharedOwners(balances, lpTokens.map(token=>[token, true]), stakingContracts, chainBlocks[chain], chain, transform) - return balances - } -} - -function pool2Exports(stakingContract, lpTokens, chain, transformAddress) { - return pool2s([stakingContract], lpTokens, chain, transformAddress) -} - -function dodoPool2(stakingContract, lpToken, chain = "ethereum", transformAddress=addr=>addr) { - return async (_timestamp, _ethBlock, chainBlocks) => { - const balances = {} - const block = chainBlocks[chain] - const [baseToken, quoteToken, totalSupply] = await Promise.all([_BASE_TOKEN_, _QUOTE_TOKEN_, "erc20:totalSupply"].map(abi => sdk.api.abi.call({ - target: lpToken, - chain, - block, - abi - }).then(r=>r.output))) - const [baseTokenBalance, quoteTokenBalance, stakedLPBalance] = await Promise.all([ - [baseToken, lpToken], [quoteToken, lpToken], [lpToken, stakingContract] - ].map(token => sdk.api.abi.call({ - target: token[0], - params: [token[1]], - chain, - block, - abi: 'erc20:balanceOf' - }).then(r=>r.output))) - sdk.util.sumSingleBalance(balances, baseToken, BigNumber(baseTokenBalance).times(stakedLPBalance).div(totalSupply).toFixed(0)) - sdk.util.sumSingleBalance(balances, quoteToken, BigNumber(quoteTokenBalance).times(stakedLPBalance).div(totalSupply).toFixed(0)) - return balances - } -} - - -async function pool2BalanceFromMasterChef(balances, masterchef, token, block, chain = "ethereum", transformAddress=(addr)=>addr, poolInfoAbi = masterchefAbi.poolInfo) { - const poolInfo = await getPoolInfo(masterchef, block, chain, poolInfoAbi) - - let symbols = ( - await sdk.api.abi.multiCall({ - calls: poolInfo.map((p) => ({ - target: p.output.lpToken, - })), - abi: "erc20:symbol", - block, - chain, - }) - ).output; - - let lpTokens = []; - - for (let i = 0; i < symbols.length; i++) { - let symbol = symbols[i]; - if (symbol.output === null) { - continue; - } - if (isLP(symbol.output, symbol.input.target, chain)){ - lpTokens.push(symbol.input.target); - } - } - - let [tokens0, tokens1] = await Promise.all([ - sdk.api.abi.multiCall({ - calls: lpTokens.map((p) => ({ - target: p, - })), - abi: token0Abi, - block, - chain, - }), - sdk.api.abi.multiCall({ - calls: lpTokens.map((p) => ({ - target: p, - })), - abi: token1Abi, - block, - chain, - }), - ]); - - let pool2LPs = []; - - for (let i = 0; i < lpTokens.length; i++) { - if ( - tokens0.output[i].output.toLowerCase() === token.toLowerCase() || - tokens1.output[i].output.toLowerCase() === token.toLowerCase() - ){ - pool2LPs.push(lpTokens[i]); - } - } - - let lpBalances = (await sdk.api.abi.multiCall({ - calls: pool2LPs.map((p) => ({ - target: p, - params: masterchef - })), - abi: "erc20:balanceOf", - block, - chain, - })).output; - - let lpPositions = lpBalances.map((p) => ({ - balance: p.output, - token: p.input.target - })); - - await unwrapUniswapLPs(balances, lpPositions, block, chain, transformAddress); - -} - -function pool2BalanceFromMasterChefExports(masterchef, token, chain = "ethereum", transformAddress=(addr)=>addr, poolInfoAbi = masterchefAbi.poolInfo) { - - return async (_timestamp, _ethBlock, chainBlocks) => { - let balances = {}; - - await pool2BalanceFromMasterChef(balances, masterchef, token, chainBlocks[chain], chain, transformAddress, poolInfoAbi); - - return balances; - } -} - -module.exports = { - pool2, - pool2Exports, - dodoPool2, - pool2s, - pool2BalanceFromMasterChef, - pool2BalanceFromMasterChefExports -} \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/portedTokens.js b/src/adapters/peggedAssets/llama-helper/portedTokens.js deleted file mode 100644 index 9120afdd..00000000 --- a/src/adapters/peggedAssets/llama-helper/portedTokens.js +++ /dev/null @@ -1,1230 +0,0 @@ -const utils = require("../helper/utils"); -const sdk = require("@defillama/sdk"); -// Does not exist -// const IOTEX_CG_MAPPING = require("./../xdollar-finance/iotex_cg_mapping.json") -const BigNumber = require("bignumber.js"); - -async function transformFantomAddress() { - const multichainTokens = ( - await utils.fetchURL("https://netapi.anyswap.net/bridge/v2/info") - ).data.bridgeList; - - const mapping = { - "0xbf07093ccd6adfc3deb259c557b61e94c1f66945": "fantom:0xd6070ae98b8069de6b494332d1a1a81b6179d960", - "0x1b156c5c75e9df4caab2a5cc5999ac58ff4f9090": "avax:0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", - "0xa48d959ae2e88f1daa7d5f611e01908106de7598": "fantom:0x841fad6eae12c286d1fd18d1d525dffa75c7effe", - "0xd795d70ec3c7b990ffed7a725a18be5a9579c3b9": "avax:0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e", - "0xb6767518b205ea8b312d2ef4d992a2a08c2f2416": "avax:0xc7198437980c041c805a1edcba50c1ce5db95118", - "0xaf9f33df60ca764307b17e62dde86e9f7090426c": "avax:0xd586e7f844cea2f87f50152665bcbc2c279d8d70", - "0x808d5f0a62336917da14fa9a10e9575b1040f71c": "avax:0x60781c2586d68229fde47564546784ab3faca982", - "0x0dec85e74a92c52b7f708c4b10207d9560cefaf0": "fantom:0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83", - "0x637ec617c86d24e421328e6caea1d92114892439": "0x6b175474e89094c44da98b954eedeac495271d0f", - "0xb3654dc3d10ea7645f8319668e8f54d2574fbdc8": "0x514910771af9ca656af840dff83e8264ecf986ca", - "0x0a03d2c1cfca48075992d810cc69bd9fe026384a": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", - "0x97927abfe1abbe5429cbe79260b290222fc9fbba": "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599", - "0x6dfe2aaea9daadadf0865b661b53040e842640f8": "0x514910771af9ca656af840dff83e8264ecf986ca", - "0x920786cff2a6f601975874bb24c63f0115df7dc8": "0x6b175474e89094c44da98b954eedeac495271d0f", - "0x49c68edb7aebd968f197121453e41b8704acde0c": "fantom:0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83", - "0x0665ef3556520b21368754fb644ed3ebf1993ad4": "0x6c3f90f043a72fa612cbac8115ee7e52bde6e490", - // update below to binspirit when it lists on coingecko - "0x7345a537a975d9ca588ee631befddfef34fd5e8f": "fantom:0x5Cc61A78F164885776AA610fb0FE1257df78E59B", - "0xdbf31df14b66535af65aac99c32e9ea844e14501": "0xeb4c2781e4eba804ce9a9803c67d0893436bb27d", // RenBTC - "0x4a89338a2079a01edbf5027330eac10b615024e5": "fantom:0xad84341756bf337f5a0164515b1f6f993d194e1f", // USDL - "0xc0d9784fdba39746919bbf236eb73bc015fd351d": "fantom:0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83", // FTML - "0xe3a486c1903ea794eed5d5fa0c9473c7d7708f40": "fantom:0xad84341756bf337f5a0164515b1f6f993d194e1f", // cUSD (revenent finance) - "0x02a2b736f9150d36c0919f3acee8ba2a92fbbb40": "0x1a7e4e63778b4f12a199c062f3efdd288afcbce8", // agEUR - "0x1b6382dbdea11d97f24495c9a90b7c88469134a4": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", // axUSDC - } - - normalizeMapping(mapping) - - return (addr) => { - addr = addr.toLowerCase() - // WFTM && FTM - if ( - compareAddresses(addr, "0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83") || - compareAddresses(addr, "0x0000000000000000000000000000000000000000") || - compareAddresses(addr, "0xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx") - ) { - return "0x4e15361fd6b4bb609fa63c81a2be19d873717870"; - } - if (compareAddresses(addr, "0x658b0c7613e890ee50b8c4bc6a3f41ef411208ad")) { - // fETH - return "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"; - } - if (compareAddresses(addr, "0x82f0b8b456c1a451378467398982d4834b6829c1")) { - // MIM - return "0x99d8a9c45b2eca8864373a26d1459e3dff1e17f3"; - } - if (compareAddresses(addr, "0x260b3e40c714ce8196465ec824cd8bb915081812")) { - return "polygon:0x4a81f8796e0c6ad4877a51c86693b0de8093f2ef"; // IRON ICE - } - const srcToken = multichainTokens.find( - (token) => token.chainId === "250" && token.token === addr.toLowerCase() - ); - if (srcToken !== undefined) { - if (srcToken.srcChainId === "1") { - return srcToken.srcToken; - } else if (srcToken.srcChainId === "56") { - if (srcToken.srcToken === "") { - return "bsc:0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c"; - } - return `bsc:${srcToken.srcToken}`; - } - } - return mapping[addr] || `fantom:${addr}`; - }; -} - -function compareAddresses(a, b) { - return a.toLowerCase() === b.toLowerCase(); -} - -async function transformAvaxAddress() { - const [bridgeTokensOld, bridgeTokensNew, bridgeTokenDetails] = - await Promise.all([ - utils.fetchURL( - "https://raw.githubusercontent.com/0xngmi/bridge-tokens/main/data/penultimate.json" - ), - utils - .fetchURL( - "https://raw.githubusercontent.com/ava-labs/avalanche-bridge-resources/main/avalanche_contract_address.json" - ) - .then((r) => Object.entries(r.data)), - utils.fetchURL( - "https://raw.githubusercontent.com/ava-labs/avalanche-bridge-resources/main/token_list.json" - ), - ]); - return (addr) => { - if (compareAddresses(addr, "0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7")) { - return "avax:0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7" - } - const srcToken = bridgeTokensOld.data.find((token) => - compareAddresses(token["Avalanche Token Address"], addr) - ); - if ( - srcToken !== undefined && - srcToken["Ethereum Token Decimals"] === - srcToken["Avalanche Token Decimals"] - ) { - return srcToken["Ethereum Token Address"]; - } - const newBridgeToken = bridgeTokensNew.find((token) => - compareAddresses(addr, token[1]) - ); - if (newBridgeToken !== undefined) { - const tokenName = newBridgeToken[0].split(".")[0]; - const tokenData = bridgeTokenDetails.data[tokenName]; - if (tokenData !== undefined) { - return tokenData.nativeContractAddress; - } - } - const map = { - "0xaf2c034c764d53005cc6cbc092518112cbd652bb": "avax:0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", - "0x57319d41f71e81f3c65f2a47ca4e001ebafd4f33": "avax:0x6e84a6216ea6dacc71ee8e6b0a5b7322eebc0fdd", - "0x0000000000000000000000000000000000000000": "avax:0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", - "0xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx": "avax:0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", - "0xd45b7c061016102f9fa220502908f2c0f1add1d7": "0xffc97d72e13e01096502cb8eb52dee56f74dad7b", - "0x46a51127c3ce23fb7ab1de06226147f446e4a857": "0xbcca60bb61934080951369a648fb03df4f96263c", - "0x532e6537fea298397212f09a61e03311686f548e": "0x3ed3b47dd13ec9a98b44e6204a523e766b225811", - "0xdfe521292ece2a4f44242efbcd66bc594ca9714b": "avax:0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", - "0x686bef2417b6dc32c50a3cbfbcc3bb60e1e9a15d": "0x9ff58f4ffb29fa2266ab25e75e2a8b3503311656", - "0x53f7c5869a859f0aec3d334ee8b4cf01e3492f21": "0x030ba81f1c18d280636f32af80b9aad02cf0854e", - "0x47afa96cdc9fab46904a55a6ad4bf6660b53c38a": "0x028171bca77440897b824ca71d1c56cac55b68a3", - "0x574679ec54972cf6d705e0a71467bb5bb362919d": "avax:0x5817d4f0b62a59b17f75207da1848c2ce75e7af4", - "0x2f28add68e59733d23d5f57d94c31fb965f835d0": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",// sUSDC(Avalanche) -> USDC(Ethereum) - "0xf04d3a8eb17b832fbebf43610e94bdc4fd5cf2dd": "bsc:0xe9e7cea3dedca5984780bafc599bd69add087d56", // sBUSD(Avalanche) -> BUSD(BSC) - "0xb0a8e082e5f8d2a04e74372c1be47737d85a0e73": "polygon:0xac63686230f64bdeaf086fe6764085453ab3023f", // USV - "0x02bfd11499847003de5f0f5aa081c43854d48815": "0x7a5d3A9Dcd33cb8D527f7b5F96EB4Fef43d55636", // Radioshack - "0xbf07093ccd6adfc3deb259c557b61e94c1f66945": "fantom:0xd6070ae98b8069de6b494332d1a1a81b6179d960", - "0x1b156c5c75e9df4caab2a5cc5999ac58ff4f9090": "avax:0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", - "0xa48d959ae2e88f1daa7d5f611e01908106de7598": "fantom:0x841fad6eae12c286d1fd18d1d525dffa75c7effe", - "0xd795d70ec3c7b990ffed7a725a18be5a9579c3b9": "avax:0xb97ef9ef8734c71904d8002f8b6bc66dd9c48a6e", - "0xb6767518b205ea8b312d2ef4d992a2a08c2f2416": "avax:0xc7198437980c041c805a1edcba50c1ce5db95118", - "0xaf9f33df60ca764307b17e62dde86e9f7090426c": "avax:0xd586e7f844cea2f87f50152665bcbc2c279d8d70", - "0x808d5f0a62336917da14fa9a10e9575b1040f71c": "avax:0x60781c2586d68229fde47564546784ab3faca982", - "0x0dec85e74a92c52b7f708c4b10207d9560cefaf0": "fantom:0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83", - "0x637ec617c86d24e421328e6caea1d92114892439": "0x6b175474e89094c44da98b954eedeac495271d0f", - "0xb3654dc3d10ea7645f8319668e8f54d2574fbdc8": "0x514910771af9ca656af840dff83e8264ecf986ca", - "0x0a03d2c1cfca48075992d810cc69bd9fe026384a": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", - "0x97927abfe1abbe5429cbe79260b290222fc9fbba": "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599", - "0x6dfe2aaea9daadadf0865b661b53040e842640f8": "0x514910771af9ca656af840dff83e8264ecf986ca", - "0x920786cff2a6f601975874bb24c63f0115df7dc8": "0x6b175474e89094c44da98b954eedeac495271d0f", - "0x49c68edb7aebd968f197121453e41b8704acde0c": "fantom:0x21be370D5312f44cB42ce377BC9b8a0cEF1A4C83", - "0x0665ef3556520b21368754fb644ed3ebf1993ad4": "0x6c3f90f043a72fa612cbac8115ee7e52bde6e490", - // update below to binspirit when it lists on coingecko - "0x7345a537a975d9ca588ee631befddfef34fd5e8f": "fantom:0x5Cc61A78F164885776AA610fb0FE1257df78E59B", - '0x90a424754ad0d72cebd440faba18cdc362bfe70a': 'heco:0xcbd6cb9243d8e3381fea611ef023e17d1b7aedf0', // BXH - '0x8965349fb649a33a30cbfda057d8ec2c48abe2a2': '0x6e9730ecffbed43fd876a264c982e254ef05a0de', // Nord - "0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7": "0xdac17f958d2ee523a2206206994597c13d831ec7" - } - return map[addr.toLowerCase()] || `avax:${addr}` - } -} - -async function transformBscAddress() { - - const mapping = { - '0x0000000000000000000000000000000000000000': 'bsc:0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c', // BNB -> WBNB - '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee': 'bsc:0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c', // BNB -> WBNB - '0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c': 'avax:0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c', // ELK - '0xb7f8cd00c5a06c0537e2abff0b58033d02e5e094': '0x8e870d67f660d95d5be530380d0ec0bd388289e1', // PAX - '0x2170ed0880ac9a755fd29b2688956bd959f933f8': '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', // WETH - '0xa35d95872d8eb056eb2cbd67d25124a6add7455e': '0x123', // 2030FLOKI returns nonsense TVL - '0x0cf8e180350253271f4b917ccfb0accc4862f262': '0x123', // BTCBR returns nonsense TVL - '0x6ded0f2c886568fb4bb6f04f179093d3d167c9d7': '0x09ce2b746c32528b7d864a1e3979bd97d2f095ab', // DFL - '0x2f28add68e59733d23d5f57d94c31fb965f835d0': '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', // sUSDC(BSC) -> USDC(Ethereum) - '0xaf6162dc717cfc8818efc8d6f46a41cf7042fcba': 'polygon:0xac63686230f64bdeaf086fe6764085453ab3023f', // USV Token - '0x30807d3b851a31d62415b8bb7af7dca59390434a': '0x7a5d3A9Dcd33cb8D527f7b5F96EB4Fef43d55636', // Radio Token - '0xce86f7fcd3b40791f63b86c3ea3b8b355ce2685b': '0xb4d930279552397bba2ee473229f89ec245bc365', // MahaDao - '0xbb9858603b1fb9375f6df972650343e985186ac5': 'bsc:0xc087c78abac4a0e900a327444193dbf9ba69058e', // Treat staked BUSD-USDC Staked APE-LP as LP Token - '0xc5fb6476a6518dd35687e0ad2670cb8ab5a0d4c5': 'bsc:0x2e707261d086687470b515b320478eb1c88d49bb', // Treat staked BUSD-USDT Staked APE-LP as LP Token - '0xaed19dab3cd68e4267aec7b2479b1ed2144ad77f': 'bsc:0xe9e7cea3dedca5984780bafc599bd69add087d56', // valas BUSD -> BUSD - '0xa6fdea1655910c504e974f7f1b520b74be21857b': 'bsc:0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d', // valas USDC -> BUSD - '0x5f7f6cb266737b89f7af86b30f03ae94334b83e9': 'bsc:0x55d398326f99059ff775485246999027b3197955', // valas USDT -> BUSD - '0x532197ec38756b9956190b845d99b4b0a88e4ca9': '0x1614f18fc94f47967a3fbe5ffcd46d4e7da3d787', // PAID - '0x6d1b7b59e3fab85b7d3a3d86e505dd8e349ea7f3': 'heco:0xcbd6cb9243d8e3381fea611ef023e17d1b7aedf0', // BXH - '0x42586ef4495bb512a86cf7496f6ef85ae7d69a64': 'polygon:0x66e8617d1df7ab523a316a6c01d16aa5bed93681', // SPICE - } - - return (addr) => { - addr = addr.toLowerCase() - - return mapping[addr] || `bsc:${addr}`; - }; -} - -const PoSMappedTokenList = - "https://api.bridge.matic.network/api/tokens/pos/erc20"; -const PlasmaMappedTokenList = - "https://api.bridge.matic.network/api/tokens/plasma/erc20"; - -async function transformPolygonAddress() { - const posTokens = await utils.fetchURL(PoSMappedTokenList); - const plasmaTokens = await utils.fetchURL(PlasmaMappedTokenList); - const tokens = posTokens.data.tokens - .concat(plasmaTokens.data.tokens) - .reduce((tokenMap, token) => { - tokenMap[token.childToken.toLowerCase()] = token.rootToken.toLowerCase(); - return tokenMap; - }, {}); - const mapping = { - '0x60d01ec2d5e98ac51c8b4cf84dfcce98d527c747': '0x9ad37205d608b8b219e6a2573f922094cec5c200', // IZI - '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee': '0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0', // - // '0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270': '0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0', // WMATIC - '0x0000000000000000000000000000000000000000': '0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0', // - '0x7ceb23fd6bc0add59e62ac25578270cff1b9f619': '0x0000000000000000000000000000000000000000', // - '0xAa9654BECca45B5BDFA5ac646c939C62b527D394': 'polygon:0xAa9654BECca45B5BDFA5ac646c939C62b527D394', // Dino - '0x2f28add68e59733d23d5f57d94c31fb965f835d0': '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // sUSDC(Polygon) -> USDC(Ethereum) - '0x9fffb2f49adfc231b44ddcff3ffcf0e81b06430a': '0x6B175474E89094C44Da98b954EedeAC495271d0F', // moUSD(Polygon) -> DAI - '0xf04d3a8eb17b832fbebf43610e94bdc4fd5cf2dd': 'bsc:0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56', // sBUSD(Polygon) -> BUSD(BSC) - '0x8eb3771a43a8c45aabe6d61ed709ece652281dc9': 'avax:0xA7D7079b0FEaD91F3e65f86E8915Cb59c1a4C664', // sUSDC.e(Polygon) -> USDC.e(Avalanche) - '0x613a489785c95afeb3b404cc41565ccff107b6e0': '0x7a5d3A9Dcd33cb8D527f7b5F96EB4Fef43d55636', // radioshack - '0x1ddcaa4ed761428ae348befc6718bcb12e63bfaa': '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', // deUSDC - } - normalizeMapping(mapping) - - return (addr) => { - addr = addr.toLowerCase() - return mapping[addr] || tokens[addr] || `polygon:${addr}`; - }; -} - -async function transformXdaiAddress() { - const mapping = { - '0x0000000000000000000000000000000000000000': '0x6b175474e89094c44da98b954eedeac495271d0f', - '0x44fa8e6f47987339850636f88629646662444217': '0x6b175474e89094c44da98b954eedeac495271d0f', - '0xe91d153e0b41518a2ce8dd3d7944fa863463a97d': '0x6b175474e89094c44da98b954eedeac495271d0f', - '0x6a023ccd1ff6f2045c3309768ead9e68f978f6e1': '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', - '0xddafbb505ad214d7b80b1f830fccc89b60fb7a83': '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', - '0x4537e328bf7e4efa29d05caea260d7fe26af9d74': '0x1f9840a85d5af5bf1d1762f925bdaddc4201f984', - '0x4ecaba5870353805a9f068101a40e0f32ed605c6': '0xdac17f958d2ee523a2206206994597c13d831ec7', - '0x7122d7661c4564b7c6cd4878b06766489a6028a2': '0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0', - '0x8e5bbbb09ed1ebde8674cda39a0c169401db4252': '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599', - // '0x29414ec76d79ff238e5e773322799d1c7ca2443f': '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599', // Boring oBTC - } - - return transformChainAddress(mapping, 'xdai', { skipUnmapped: false }) -} - -async function transformOkexAddress() { - // const okexBridge = ( - // await utils.fetchURL( - // "https://www.okex.com/v2/asset/cross-chain/currencyAddress" - // ) - // ).data.data.tokens; TODO - const mapping = { - '0x0000000000000000000000000000000000000000': '0x75231f58b43240c9718dd58b4967c5114342a86c', // okex - '0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c': 'avax:0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c', - } - - normalizeMapping(mapping) - - return (addr) => { - addr = addr.toLowerCase() - if (mapping[addr]) return mapping[addr] - return `okexchain:${addr}`; - }; -} - - -async function transformHecoAddress() { - const mapping = { - '0xb6f4c418514dd4680f76d5caa3bb42db4a893acb': 'bsc:0x250632378e573c6be1ac2f97fcdf00515d0aa91b', - '0x0000000000000000000000000000000000000000': '0x6f259637dcd74c767781e37bc6133cd6a68aa161', - '0xhecozzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz': '0x6f259637dcd74c767781e37bc6133cd6a68aa161', - '0x5545153ccfca01fbd7dd11c0b23ba694d9509a6f': '0x6f259637dcd74c767781e37bc6133cd6a68aa161', - '0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c': 'avax:0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c', - '0x3D760a45D0887DFD89A2F5385a236B29Cb46ED2a': '0x6b175474e89094c44da98b954eedeac495271d0f', - '0x9362Bbef4B8313A8Aa9f0c9808B80577Aa26B73B': '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', - '0xCe0A5CA134fb59402B723412994B30E02f083842': '0xc00e94cb662c3520282e6f5717214004a7f26888', - '0x1Ee8382bE3007Bd9249a89f636506284DdEf6Cc0': '0x35a532d376ffd9a705d0bb319532837337a398e7', - '0x40280e26a572745b1152a54d1d44f365daa51618': 'bsc:0xba2ae424d960c26247dd6c32edc70b295c744c43', - '0x5ee41ab6edd38cdfb9f6b4e6cf7f75c87e170d98': '0x0000000000085d4780b73119b644ae5ecd22b376', - } - - return transformChainAddress(mapping, 'heco', { skipUnmapped: false }) -} - -async function transformHooAddress() { - const mapping = { - '0xd16babe52980554520f6da505df4d1b124c815a7': '0xdac17f958d2ee523a2206206994597c13d831ec7', // USDT - '0x3eff9d389d13d6352bfb498bcf616ef9b1beac87': '0x6f259637dcd74c767781e37bc6133cd6a68aa161', // wHOO - } - normalizeMapping(mapping) - - return (addr) => { - addr = addr.toLowerCase() - return mapping[addr] || `hoo:${addr}`; - }; -} - - -async function transformCeloAddress() { - return (addr) => { - return `celo:${addr}`; - }; -} - -async function transformHarmonyAddress() { - const bridge = ( - await utils.fetchURL("https://be4.bridge.hmny.io/tokens/?page=0&size=1000") - ).data.content; - - const mapping = { - '0x6983D1E6DEf3690C4d616b13597A09e6193EA013': '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', - '0xcF664087a5bB0237a0BAd6742852ec6c8d69A27a': 'harmony:0xcF664087a5bB0237a0BAd6742852ec6c8d69A27a', - '0x72cb10c6bfa5624dd07ef608027e366bd690048f': 'harmony:0x72cb10c6bfa5624dd07ef608027e366bd690048f', - '0xa9ce83507d872c5e1273e745abcfda849daa654f': 'harmony:0xa9ce83507d872c5e1273e745abcfda849daa654f', - "0xb12c13e66ade1f72f71834f2fc5082db8c091358": "avax:0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", //avax - '0x224e64ec1bdce3870a6a6c777edd450454068fec': '0xa47c8bf37f92abed4a126bda807a7b7498661acd', - '0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c': '0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c', - '0xd754ae7bb55feb0c4ba6bc037b4a140f14ebe018': '0x19e6bfc1a6e4b042fb20531244d47e252445df01', - '0x0000000000000000000000000000000000000000': '0x799a4202c12ca952cB311598a024C80eD371a41e', // Harmony ONE - '0x3c2b8be99c50593081eaa2a724f0b8285f5aba8f': '0xdAC17F958D2ee523a2206206994597C13D831ec7', // USDT - '0x985458e523db3d53125813ed68c274899e9dfab4': '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // USDC - '0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1': '0x6B175474E89094C44Da98b954EedeAC495271d0F', // DAI - } - - normalizeMapping(mapping) - - return (addr) => { - addr = addr.toLowerCase() - if (mapping[addr]) return mapping[addr] - const srcToken = bridge.find((token) => - compareAddresses(addr, token.hrc20Address) - ); - if (srcToken !== undefined) { - const prefix = srcToken.network === "BINANCE" ? "bsc:" : ""; - return prefix + srcToken.erc20Address; - } - return `harmony:${addr}`; - }; -} - -const optimismSynths = { - "0x8c6f28f2f1a3c87f0f938b96d27520d9751ec8d9": - "0x57ab1ec28d129707052df4df418d58a2d46d5f51", - "0xc5db22719a06418028a40a9b5e9a7c02959d0d08": - "0xbbc455cb4f1b9e4bfc4b73970d360c8f032efee6", - "0xe405de8f52ba7559f9df3c368500b6e6ae6cee49": - "0x5e74c9036fb86bd7ecdcb084a0673efc32ea31cb", - "0x298b9b95708152ff6968aafd889c6586e9169f1d": - "0xfe18be6b3bd88a2d2a7f928d00292e7a9963cfc6", -}; - -async function transformOptimismAddress() { - const bridge = ( - await utils.fetchURL("https://static.optimism.io/optimism.tokenlist.json") - ).data.tokens; - - const mapping = { - '0x4200000000000000000000000000000000000006': '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', - '0x5029c236320b8f15ef0a657054b84d90bfbeded3': '0x15ee120fd69bec86c1d38502299af7366a41d1a6', - '0x0000000000000000000000000000000000000000': '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', // OETH -> WETH - '0x121ab82b49B2BC4c7901CA46B8277962b4350204': '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', // synapse WETH -> WETH - '0x35D48A789904E9b15705977192e5d95e2aF7f1D3': '0x956f47f50a910163d8bf957cf5846d573e7f87ca', // FEI - '0xcb8fa9a76b8e203d8c3797bf438d8fb81ea3326a': '0xbc6da0fe9ad5f3b0d58160288917aa56653660e9', // alUSD - '0x67CCEA5bb16181E7b4109c9c2143c24a1c2205Be': '0x3432b6a60d23ca0dfca7761b7ab56459d9c964d0', // FRAX Share - '0x2E3D870790dC77A83DD1d18184Acc7439A53f475': '0x853d955acef822db058eb8505911ed77f175b99e', // FRAX - '0x0b5740c6b4a97f90eF2F0220651Cca420B868FfB': '0x0ab87046fbb341d058f17cbc4c1133f25a20a52f', // gOHM - } - normalizeMapping(mapping) - - return (addr) => { - addr = addr.toLowerCase() - - if (mapping[addr]) return mapping[addr] - - const possibleSynth = optimismSynths[addr.toLowerCase()]; - if (possibleSynth !== undefined) { - return possibleSynth; - } - const dstToken = bridge.find( - (token) => compareAddresses(addr, token.address) && token.chainId === 10 - ); - if (dstToken !== undefined) { - const srcToken = bridge.find( - (token) => dstToken.logoURI === token.logoURI && token.chainId === 1 - ); - if (srcToken !== undefined) { - return srcToken.address; - } - } - return `optimism:${addr}` - }; -} - -async function transformMoonriverAddress() { - const mapping = { - '0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c': 'avax:0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c', - '0x0000000000000000000000000000000000000000': 'moonriver:0x98878B06940aE243284CA214f92Bb71a2b032B8A', - } - - return transformChainAddress(mapping, 'moonriver', { skipUnmapped: false }) -} - -async function transformMoonbeamAddress() { - return (addr) => { - if (compareAddresses(addr, "0x8f552a71EFE5eeFc207Bf75485b356A0b3f01eC9")) { //usdc - return "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48"; - } - if (compareAddresses(addr, "0x8e70cD5B4Ff3f62659049e74b6649c6603A0E594")) { //usdt - return "0xdac17f958d2ee523a2206206994597c13d831ec7"; - } - if (compareAddresses(addr, "0x30D2a9F5FDf90ACe8c17952cbb4eE48a55D916A7")) { //eth - return "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"; - } - if (compareAddresses(addr, "0x1DC78Acda13a8BC4408B207c9E48CDBc096D95e0")) { // wtbc - return "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599"; - } - if (compareAddresses(addr, "0xc234A67a4F840E61adE794be47de455361b52413")) { // dai - return "0x6b175474e89094c44da98b954eedeac495271d0f"; - } - if (compareAddresses(addr, "0x1d4C2a246311bB9f827F4C768e277FF5787B7D7E")) { //movr - return "moonriver:0x98878b06940ae243284ca214f92bb71a2b032b8a"; - } - // if (compareAddresses(addr, "0x0000000000000000000000000000000000000802")) { //GLMR - // return "moonbeam"; - // } - if (compareAddresses(addr, "0x0000000000000000000000000000000000000000")) { //GLMR -> WGLMR - return "moonbeam:0xacc15dc74880c9944775448304b263d191c6077f"; - } - return `moonbeam:${addr}`; //`optimism:${addr}` // TODO: Fix - }; -} - -async function transformArbitrumAddress() { - const bridge = ( - await utils.fetchURL("https://bridge.arbitrum.io/token-list-42161.json") - ).data.tokens; - const mapping = { - '0x0000000000000000000000000000000000000000': '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', // WETH - '0x09ad12552ec45f82be90b38dfe7b06332a680864': 'polygon:0xc3fdbadc7c795ef1d6ba111e06ff8f16a20ea539', // ADDy - '0xFEa7a6a0B346362BF88A9e4A88416B77a57D6c2A': '0x99d8a9c45b2eca8864373a26d1459e3dff1e17f3', // MIM - '0xDBf31dF14B66535aF65AaC99C32e9eA844e14501': '0xeb4c2781e4eba804ce9a9803c67d0893436bb27d', // renBTC - '0x9ef758ac000a354479e538b8b2f01b917b8e89e7': 'polygon:0x3dc7b06dd0b1f08ef9acbbd2564f8605b4868eea', // XDO - '0x31635A2a3892dAeC7C399102676E344F55d20Da7': '0x09ce2b746c32528b7d864a1e3979bd97d2f095ab', // DeFIL - '0x4a717522566c7a09fd2774ccedc5a8c43c5f9fd2': '0x956f47f50a910163d8bf957cf5846d573e7f87ca', // FEI - '0x289ba1701c2f088cf0faf8b3705246331cb8a839': '0x58b6a8a3302369daec383334672404ee733ab239', // LPT - } - - normalizeMapping(mapping) - - return (addr) => { - - addr = addr.toLowerCase() - if (mapping[addr]) return mapping[addr] - const dstToken = bridge.find((token) => compareAddresses(addr, token.address)); - if (dstToken !== undefined) { - return dstToken.extensions.bridgeInfo[1].tokenAddress; - } - return `arbitrum:${addr}`; - }; -} - -async function transformFuseAddress() { - const mapping = { - '0x0000000000000000000000000000000000000000': '0x970b9bb2c0444f5e81e9d0efb84c8ccdcdcaf84d', // FUSE - '0x0be9e53fd7edac9f859882afdda116645287c629': '0x970b9bb2c0444f5e81e9d0efb84c8ccdcdcaf84d', // FUSE - '0x620fd5fa44BE6af63715Ef4E65DDFA0387aD13F5': '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // USDC - '0x28C3d1cD466Ba22f6cae51b1a4692a831696391A': '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', - '0x94Ba7A27c7A95863d1bdC7645AC2951E0cca06bA': '0x6B175474E89094C44Da98b954EedeAC495271d0F', // DAI - '0xFaDbBF8Ce7D5b7041bE672561bbA99f79c532e10': '0xdAC17F958D2ee523a2206206994597C13D831ec7', // USDT - '0xa722c13135930332Eb3d749B2F0906559D2C5b99': '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', // WETH - '0x43b17749b246fd2a96de25d9e4184e27e09765b0': '0xdefa4e8a7bcba345f687a2f1456f5edd9ce97202', // KYC - } - - return transformChainAddress(mapping, 'fuse', { skipUnmapped: true, chainName: 'fuse' }) -} - -async function transformEvmosAddress() { - const mapping = { - // '0x0000000000000000000000000000000000000000': '', // EVMOS - // '0xD4949664cD82660AaE99bEdc034a0deA8A0bd517': '', // WEVMOS - '0x51e44FfaD5C2B122C8b635671FCC8139dc636E82': '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // madUSDC - '0xe46910336479F254723710D57e7b683F3315b22B': '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // ceUSDC - '0x63743ACF2c7cfee65A5E356A4C4A005b586fC7AA': '0x6B175474E89094C44Da98b954EedeAC495271d0F', // DAI - '0x7FF4a56B32ee13D7D4D405887E0eA37d61Ed919e': '0xdAC17F958D2ee523a2206206994597C13D831ec7', // madUSDT - '0xb72A7567847abA28A2819B855D7fE679D4f59846': '0xdAC17F958D2ee523a2206206994597C13D831ec7', // ceUSDT - '0x5842C5532b61aCF3227679a8b1BD0242a41752f2': '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', // WETH - '0xF80699Dc594e00aE7bA200c7533a07C1604A106D': '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599', // WBTC - '0x28eC4B29657959F4A5052B41079fe32919Ec3Bd3': '0x853d955aCEf822Db058eb8505911ED77F175b99e', // madFRAX - '0xE03494D0033687543a80c9B1ca7D6237F2EA8BD8': '0x853d955aCEf822Db058eb8505911ED77F175b99e', // FRAX - } - - return transformChainAddress(mapping, 'evmos', { skipUnmapped: false, chainName: 'evmos' }) -} - - - -function fixAvaxBalances(balances) { - for (const representation of [ - "avax:0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7", - "0x9dEbca6eA3af87Bf422Cea9ac955618ceb56EfB4", - ]) { - if (balances[representation] !== undefined) { - balances["avalanche-2"] = Number(balances[representation]) / 1e18; - delete balances[representation]; - } - } -} - -function fixHarmonyBalances(balances) { - for (const representation of [ - "harmony:0xcf664087a5bb0237a0bad6742852ec6c8d69a27a", - "0xcf664087a5bb0237a0bad6742852ec6c8d69a27a", - "harmony:0xcF664087a5bB0237a0BAd6742852ec6c8d69A27a", - "0xcF664087a5bB0237a0BAd6742852ec6c8d69A27a", - "bsc:0xdE976f3344cd9F06E451aF3A94a324afC3E154F4", - "bsc:0xde976f3344cd9f06e451af3a94a324afc3e154f4", - '0x799a4202c12ca952cB311598a024C80eD371a41e', - ]) { - if (balances[representation] !== undefined) { - sdk.util.sumSingleBalance(balances, 'harmony', Number(balances[representation]) / 1e18) - delete balances[representation]; - } - } - const xJewel = 'harmony:0xa9ce83507d872c5e1273e745abcfda849daa654f' - if (balances[xJewel]) { - sdk.util.sumSingleBalance(balances, 'xjewel', Number(balances[xJewel]) / 1e18) - delete balances[xJewel] - } -} - -function transformOasisAddressBase(addr) { - const map = { - '0x21c718c22d52d0f3a789b752d4c2fd5908a8a733': 'oasis-network', - '0x3223f17957ba502cbe71401d55a0db26e5f7c68f': '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', //WETH - '0xe8a638b3b7565ee7c5eb9755e58552afc87b94dd': '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', // USDC - '0x4bf769b05e832fcdc9053fffbc78ca889acb5e1e': '0xdac17f958d2ee523a2206206994597c13d831ec7', // USDT - '0x6cb9750a92643382e020ea9a170abb83df05f30b': '0xdac17f958d2ee523a2206206994597c13d831ec7', // USDT - '0xdc19a122e268128b5ee20366299fc7b5b199c8e3': '0xdac17f958d2ee523a2206206994597c13d831ec7', // USDT wormhole - '0x81ecac0d6be0550a00ff064a4f9dd2400585fe9c': '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', // USDC celer - '0x94fbffe5698db6f54d6ca524dbe673a7729014be': '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', // USDC - '0x80a16016cc4a2e6a2caca8a4a498b1699ff0f844': '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // USDC - //'0x21c718c22d52d0f3a789b752d4c2fd5908a8a733': 'wrapped-rose', - } - return map[addr.toLowerCase()] || `${addr}` -} - -async function transformOasisAddress() { - return transformOasisAddressBase -} -function fixBscBalances(balances) { - if (balances['bsc:0x8b04E56A8cd5f4D465b784ccf564899F30Aaf88C']) { - sdk.util.sumSingleBalance(balances, 'anchorust', - Number(balances['bsc:0x8b04E56A8cd5f4D465b784ccf564899F30Aaf88C']) / 10 ** 6) - } -} -function fixOasisBalances(balances) { - ['oasis-network', 'wrapped-rose'].forEach(key => { - if (balances[key]) - balances[key] = balances[key] / 10 ** 18; - }) -} - -// Does not exist -// async function transformIotexAddress() { -// return (addr) => { -// const dstToken = Object.keys(IOTEX_CG_MAPPING).find(token => compareAddresses(addr, token)) -// if (dstToken !== undefined) { -// return IOTEX_CG_MAPPING[dstToken].contract || IOTEX_CG_MAPPING[dstToken].coingeckoId -// } -// return `iotex:${addr}`; -// }; -// } - -async function transformKccAddress() { - return (addr) => { - if (compareAddresses(addr, "0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c")) { - return "avax:0xe1c110e1b1b4a1ded0caf3e42bfbdbb7b5d7ce1c"; - } - if (compareAddresses(addr, "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48")) { - return "okexchain:0xc946daf81b08146b1c7a8da2a851ddf2b3eaaf85"; - } - if (compareAddresses(addr, "0x639a647fbe20b6c8ac19e48e2de44ea792c62c5c")) { - return "bsc:0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"; - } - if (compareAddresses(addr, "0xe3f5a90f9cb311505cd691a46596599aa1a0ad7d")) { - return "0x4fabb145d64652a948d72533023f6e7a623c7c53"; - } - if (compareAddresses(addr, "0xc9baa8cfdde8e328787e29b4b078abf2dadc2055")) { - return "0x6b175474e89094c44da98b954eedeac495271d0f"; - } - if (compareAddresses(addr, "0x218c3c3d49d0e7b37aff0d8bb079de36ae61a4c0")) { - return "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599"; - } - if (compareAddresses(addr, "0xf55af137a98607f7ed2efefa4cd2dfe70e4253b1")) { - return "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"; - } - if (compareAddresses(addr, "0x980a5afef3d17ad98635f6c5aebcbaeded3c3430")) { - return "okexchain:0xc946daf81b08146b1c7a8da2a851ddf2b3eaaf85"; - } - return `kcc:${addr}`; - }; -} - - -function transformMetisAddress() { - const map = { - "0xdeaddeaddeaddeaddeaddeaddeaddeaddead0000": "0x9e32b13ce7f2e80a01932b42553652e053d6ed8e", - "0xbb06dca3ae6887fabf931640f67cab3e3a16f4dc": "0xdac17f958d2ee523a2206206994597c13d831ec7", - "0x420000000000000000000000000000000000000a": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", - "0x5801d0e1c7d977d78e4890880b8e579eb4943276": "bsc:0x5801d0e1c7d977d78e4890880b8e579eb4943276", - "0xea32a96608495e54156ae48931a7c20f0dcc1a21": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", - "0x2692be44a6e38b698731fddf417d060f0d20a0cb": "bsc:0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c", - } - return (addr) => { - if (compareAddresses(addr, "0xa5B55ab1dAF0F8e1EFc0eB1931a957fd89B918f4")) { - return "avax:0x50b7545627a5162F82A992c33b87aDc75187B218"; - } - if (compareAddresses(addr, "0xE253E0CeA0CDD43d9628567d097052B33F98D611")) { - return "avax:0xE253E0CeA0CDD43d9628567d097052B33F98D611"; - } - - if (compareAddresses(addr, "0x4651B38e7ec14BB3db731369BFE5B08F2466Bd0A")) { - return "bsc:0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3"; - } - - if (compareAddresses(addr, "0xfe282Af5f9eB59C30A3f78789EEfFA704188bdD4")) { - return "metis:0xfe282Af5f9eB59C30A3f78789EEfFA704188bdD4"; - } - - if (compareAddresses(addr, "0x6aB6d61428fde76768D7b45D8BFeec19c6eF91A8")) { - return "bsc:0xad29abb318791d579433d831ed122afeaf29dcfe"; - } - - if (compareAddresses(addr, "0x4b9D2923D875edF43980BF5dddDEde3Fb20fC742")) { - return "bsc:0xcc42724c6683b7e57334c4e856f4c9965ed682bd"; - } - - return map[addr.toLowerCase()] || `metis:${addr}` - }; -} - -function transformBobaAddress() { - const map = { - "0x0000000000000000000000000000000000000000": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", // WETH - "0xd203De32170130082896b4111eDF825a4774c18E": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", // synapse wETH - "0xdeaddeaddeaddeaddeaddeaddeaddeaddead0000": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", // WETH - "0x66a2a913e447d6b4bf33efbec43aaef87890fbbc": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", // USDC - "0x5de1677344d3cb0d7d465c10b72a8f60699c062d": "0xdac17f958d2ee523a2206206994597c13d831ec7", // USDT - "0xf74195bb8a5cf652411867c5c2c5b8c2a402be35": "0x6b175474e89094c44da98b954eedeac495271d0f", // DAI - "0x461d52769884ca6235B685EF2040F47d30C94EB5": "bsc:0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56", // BUSD - "0xdc0486f8bf31df57a952bcd3c1d3e166e3d9ec8b": "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599", // WBTC - "0xa18bf3994c0cc6e3b63ac420308e5383f53120d7": "0x42bbfa2e77757c645eeaad1655e0911a7553efbc", // BOBA - "0xe1e2ec9a85c607092668789581251115bcbd20de": "0xd26114cd6EE289AccF82350c8d8487fedB8A0C07", // OMG - "0x7562f525106f5d54e891e005867bf489b5988cd9": "0x853d955acef822db058eb8505911ed77f175b99e", // FRAX - "0x2f28add68e59733d23d5f57d94c31fb965f835d0": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // sUSDC(Boba) -> USDC(Ethereum) - "0xf04d3a8eb17b832fbebf43610e94bdc4fd5cf2dd": "bsc:0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56", // sBUSD(Boba) -> BUSD(BSC) - } - - normalizeMapping(map) - - return (addr) => { - return map[addr.toLowerCase()] || `boba:${addr}` - } -} - -function transformNearAddress() { - return (addr) => { - const bridgedAssetIdentifier = '.factory.bridge.near' - if (addr.endsWith(bridgedAssetIdentifier)) - return `0x${addr.slice(0, addr.length - bridgedAssetIdentifier.length)}` - - return addr - } -} - -async function transformKlaytnAddress() { - const mapping = { - '0x5388ce775de8f7a69d17fd5caa9f7dbfee65dfce': '0x4576E6825B462b6916D2a41E187626E9090A92c6', // Donkey - '0x9eaefb09fe4aabfbe6b1ca316a3c36afc83a393f': 'ripple', // XRP - '0x02cbe46fb8a1f579254a9b485788f2d86cad51aa': '0x26fb86579e371c7aedc461b2ddef0a8628c93d3b', // bora - '0x5c74070fdea071359b86082bd9f9b3deaafbe32b': '0x6b175474e89094c44da98b954eedeac495271d0f', // dai - '0x754288077d0ff82af7a5317c7cb8c444d421d103': '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', // USDC - '0x0268dbed3832b87582b1fa508acf5958cbb1cd74': 'bsc:0xf258f061ae2d68d023ea6e7cceef97962785c6c1', // IJM - '0xcee8faf64bb97a73bb51e115aa89c17ffa8dd167': '0xdac17f958d2ee523a2206206994597c13d831ec7', // USDT - '0x168439b5eebe8c83db9eef44a0d76c6f54767ae4': '0x6b175474e89094c44da98b954eedeac495271d0f', // pUSD - '0x4fa62f1f404188ce860c8f0041d6ac3765a72e67': '0x6b175474e89094c44da98b954eedeac495271d0f', // KSD - '0xce40569d65106c32550626822b91565643c07823': '0x6b175474e89094c44da98b954eedeac495271d0f', // KASH - '0x210bc03f49052169d5588a52c317f71cf2078b85': 'bsc:0xe9e7cea3dedca5984780bafc599bd69add087d56', // kBUSD - '0x16d0e1fbd024c600ca0380a4c5d57ee7a2ecbf9c': '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599', // WBTC - '0x34d21b1e550d73cee41151c77f3c73359527a396': '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', // WETH - '0x0000000000000000000000000000000000000000': 'klay-token', // Klaytn - } - - return addr => { - addr = addr.toLowerCase() - return mapping[addr] || `klaytn:${addr}` - } -} - -function fixKlaytnBalances(balances) { - const mapping = { - '0xd7a4d10070a4f7bc2a015e78244ea137398c3b74': { coingeckoId: 'klay-token', decimals: 18, }, // Wrapped KLAY - '0xc6a2ad8cc6e4a7e08fc37cc5954be07d499e7654': { coingeckoId: 'klayswap-protocol', decimals: 18, }, // Wrapped KLAY - } - return fixBalances(balances, mapping) -} - -function transformVelasAddress() { - return (addr) => { - const map = { - "0x85219708c49aa701871ad330a94ea0f41dff24ca": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", // WETH - "0xe2c120f188ebd5389f71cf4d9c16d05b62a58993": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", // USDC - "0x01445c31581c354b7338ac35693ab2001b50b9ae": "0xdac17f958d2ee523a2206206994597c13d831ec7", // USDT - "0xc111c29a988ae0c0087d97b33c6e6766808a3bd3": "bsc:0xe9e7cea3dedca5984780bafc599bd69add087d56", // BUSD - "0x300a8be53b4b5557f48620d578e7461e3b927dd0": "0xf56842af3b56fd72d17cb103f92d027bba912e89", // BAMBOO - } - return map[addr.toLowerCase()] || `velas:${addr}` - } -} - -async function transformCronosAddress() { - const mapping = { - '0x0000000000000000000000000000000000000000': '0xa0b73e1ff0b80914ab6fe0444e65848c4c34450b', - '0x09ad12552ec45f82be90b38dfe7b06332a680864': 'polygon:0xc3fdbadc7c795ef1d6ba111e06ff8f16a20ea539', // ADDY - } - return (addr) => mapping[addr.toLowerCase()] || `cronos:${addr.toLowerCase()}` -} - -function fixShidenBalances(balances) { - const mapping = { - '0x0f933dc137d21ca519ae4c7e93f87a4c8ef365ef': { coingeckoId: 'shiden', decimals: 18, }, - '0xb4BcA5955F26d2fA6B57842655d7aCf2380Ac854': { coingeckoId: 'emiswap', decimals: 18, }, - '0x765277EebeCA2e31912C9946eAe1021199B39C61': { coingeckoId: 'ethereum', decimals: 18, }, - '0x332730a4f6e03d9c55829435f10360e13cfa41ff': { coingeckoId: 'binancecoin', decimals: 18, }, - '0x65e66a61d0a8f1e686c2d6083ad611a10d84d97a': { coingeckoId: 'binance-usd', decimals: 18, }, - '0x722377a047e89ca735f09eb7cccab780943c4cb4': { coingeckoId: 'standard-protocol', decimals: 18, }, - } - - return fixBalances(balances, mapping, { removeUnmapped: true }) -} - -function fixAstarBalances(balances) { - const mapping = { - '0x81ECac0D6Be0550A00FF064a4f9dd2400585FE9c': { coingeckoId: 'ethereum', decimals: 18, }, - '0x7f27352d5f83db87a5a3e00f4b07cc2138d8ee52': { coingeckoId: 'binancecoin', decimals: 18, }, - '0x75364D4F779d0Bd0facD9a218c67f87dD9Aff3b4': { coingeckoId: 'shiden', decimals: 18, }, - '0xad543f18cff85c77e140e3e5e3c3392f6ba9d5ca': { coingeckoId: 'bitcoin', decimals: 8, }, - '0x3795C36e7D12A8c252A20C5a7B455f7c57b60283': { coingeckoId: 'tether', decimals: 6, }, - '0x430D50963d9635bBef5a2fF27BD0bDDc26ed691F': { coingeckoId: 'tether', decimals: 6, }, - '0x19574c3c8fafc875051b665ec131b7e60773d2c9': { coingeckoId: 'astar', decimals: 18, }, - '0xAeaaf0e2c81Af264101B9129C00F4440cCF0F720': { coingeckoId: 'astar', decimals: 18, }, - '0xb361DAD0Cc1a03404b650A69d9a5ADB5aF8A531F': { coingeckoId: 'emiswap', decimals: 18, }, - '0xC404E12D3466acCB625c67dbAb2E1a8a457DEf3c': { coingeckoId: 'usd-coin', decimals: 6, }, // interest bearing USDC - '0x6a2d262D56735DbA19Dd70682B39F6bE9a931D98': { coingeckoId: 'usd-coin', decimals: 6, }, - '0x6De33698e9e9b787e09d3Bd7771ef63557E148bb': { coingeckoId: 'dai', decimals: 18, }, - '0x4dd9c468A44F3FEF662c35c1E9a6108B70415C2c': { coingeckoId: 'dai', decimals: 18, }, - '0x4Bf769b05E832FCdc9053fFFBC78Ca889aCb5E1E': { coingeckoId: 'binance-usd', decimals: 18, }, - '0xb7aB962c42A8Bb443e0362f58a5A43814c573FFb': { coingeckoId: 'binance-usd', decimals: 18, }, - '0x29F6e49c6E3397C3A84F715885F9F233A441165C': { coingeckoId: 'dai', decimals: 18, }, - '0x733ebcC6DF85f8266349DEFD0980f8Ced9B45f35': { coingeckoId: 'bai-stablecoin', decimals: 18, }, - '0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF': { coingeckoId: 'polkadot', decimals: 10, }, - '0x431D5dfF03120AFA4bDf332c61A6e1766eF37BDB': { coingeckoId: 'jpy-coin', decimals: 18, }, - // '0x29F6e49c6E3397C3A84F715885F9F233A441165C': { coingeckoId: 'orcus-ousd', decimals: 18, }, // todo: fix this, use correct coingecko id - } - - return fixBalances(balances, mapping) -} - -function fixMantaBalances(balances) { - const mapping = { - '0xcd91716ef98798A85E79048B78287B13ae6b99b2': { coingeckoId: 'goku-money-gai', decimals: 18, }, - } - - return fixBalances(balances, mapping) -} - -function fixHPBBalances(balances) { - const mapping = { - '0xBE05Ac1FB417c9EA435b37a9Cecd39Bc70359d31': { coingeckoId: 'high-performance-blockchain', decimals: 18, }, - } - - return fixBalances(balances, mapping, { removeUnmapped: true }) -} - -async function transformAstarAddress() { - return (addr) => addr // we use fix balances instead -} - -const cronosFixMapping = { - '0x45c135c1cdce8d25a3b729a28659561385c52671': { coingeckoId: 'alethea-artificial-liquid-intelligence-token', decimals: 18, }, - '0x39a65a74dc5a778ff93d1765ea51f57bc49c81b3': { coingeckoId: 'akash-network', decimals: 6, }, - '0xbed48612bc69fa1cab67052b42a95fb30c1bcfee': { coingeckoId: 'shiba-inu', decimals: 18, }, - '0x1a8e39ae59e5556b56b76fcba98d22c9ae557396': { coingeckoId: 'dogecoin', decimals: 8, }, - '0xb888d8dd1733d72681b30c00ee76bde93ae7aa93': { coingeckoId: 'cosmos', decimals: 6, }, - '0x02dccaf514c98451320a9365c5b46c61d3246ff3': { coingeckoId: 'dogelon-mars', decimals: 18, }, -} - -async function transformDfkAddress() { - const mapping = { - '0xb57b60debdb0b8172bb6316a9164bd3c695f133a': 'avax:0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7', // AVAX - '0x3ad9dfe640e1a9cc1d9b0948620820d975c3803a': '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', // USDC - } - return (addr) => mapping[addr.toLowerCase()] || `dfk:${addr.toLowerCase()}` -} -async function transformAuroraAddress() { - const mapping = { - '0xda2585430fef327ad8ee44af8f1f989a2a91a3d2': '0x853d955aCEf822Db058eb8505911ED77F175b99e', // FRAX - } - return (addr) => mapping[addr.toLowerCase()] || `aurora:${addr.toLowerCase()}` -} - -function fixGodwokenBalances(balances) { - const mapping = { - '0xC3b946c53E2e62200515d284249f2a91d9DF7954': { coingeckoId: 'usd-coin', decimals: 6, }, // Wrapped USDC (ForceBridge from Ethereum) - '0xA21B19d660917C1DE263Ad040Ba552737cfcEf50': { coingeckoId: 'usd-coin', decimals: 18, }, // Wrapped USDC (ForceBridge from BSC) - '0x07a388453944bB54BE709AE505F14aEb5d5cbB2C': { coingeckoId: 'tether', decimals: 6, }, // Wrapped USDT (ForceBridge from Ethereum) - '0x5C30d9396a97f2279737E63B2bf64CC823046591': { coingeckoId: 'tether', decimals: 18, }, // Wrapped USDT (ForceBridge from BSC) - '0x7818FA4C71dC3b60049FB0b6066f18ff8c720f33': { coingeckoId: 'bitcoin', decimals: 8, }, // Wrapped BTC (ForceBridge from Ethereum) - '0x3f8d2b24C6fa7b190f368C3701FfCb2bd919Af37': { coingeckoId: 'bitcoin', decimals: 18, }, // Wrapped BTC (ForceBridge from BSC) - } - - return fixBalances(balances, mapping) -} - - -const wavesMapping = { - '5UYBPpq4WoU5n4MwpFkgJnW3Fq4B1u3ukpK33ik4QerR': { coingeckoId: 'binancecoin', decimals: 8, }, - 'DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p': { coingeckoId: 'neutrino', decimals: 6, }, - 'Atqv59EYzjFGuitKVnMRk6H8FukjoV3ktPorbEys25on': { coingeckoId: 'waves-exchange', decimals: 8, }, - '474jTeYx2r2Va35794tCScAXWJG9hU2HcgxzMowaZUnu': { coingeckoId: 'ethereum', decimals: 8, }, - '34N9YcEETLWn93qYQ64EsP1x89tSruJU44RrEMSXXEPJ': { coingeckoId: 'tether', decimals: 6, }, - '8LQW8f7P5d5PZM7GtZEBgaqRPGSzS3DfPuiXrURJ4AJS': { coingeckoId: 'bitcoin', decimals: 8, }, - 'WAVES': { coingeckoId: 'waves', decimals: 8, }, - '2Fh9m3dNQXycHdnytEaETN3P1gDT7ij5U4HjMqQBeaqN': { coingeckoId: 'ftx-token', decimals: 8, }, - '4GZH8rk5vDmMXJ81Xqfm3ovFaczqMnQ11r7aELiNxWBV': { coingeckoId: 'fantom', decimals: 8, }, - '3KhNcHo4We1G5EWps7b1e5DTdLgWDzctc8S6ynu37KAb': { coingeckoId: 'curve-dao-token', decimals: 8, }, - 'GVxGPBtgVWMW1wHiFnfaCakbJ6sKgZgowJgW5Dqrd7JH': { coingeckoId: 'shiba-inu', decimals: 2, }, - 'HcHacFH51pY91zjJa3ZiUVWBww54LnsL4EP3s7hVGo9L': { coingeckoId: 'matic-network', decimals: 8, }, - '4YmM7mj3Av4DPvpNpbtK4jHbpzYDcZuY6UUnYpqTbzLj': { coingeckoId: 'uniswap', decimals: 8, }, - '6QUVF8nVVVvM7do7JT2eJ5o5ehnZgXUg13ysiB9JiQrZ': { coingeckoId: 'terra-luna', decimals: 8, }, - '7TMu26hAs7B2oW6c5sfx45KSZT7GQA3TZNYuCav8Dcqt': { coingeckoId: 'aave', decimals: 8, }, - 'E4rss7qLUcawCvD2uMrbLeTMPGkX15kS3okWCbUhLNKL': { coingeckoId: 'maker', decimals: 8, }, - 'HLckRcg7hJ3Syf3PrGftFijKqQMJipf81WY3fwvHCJbe': { coingeckoId: 'crypto-com-chain', decimals: 8, }, - '8zUYbdB8Q6mDhpcXYv52ji8ycfj4SDX4gJXS7YY3dA4R': { coingeckoId: 'dai', decimals: 6, }, - '8DLiYZjo3UUaRBTHU7Ayoqg4ihwb6YH1AfXrrhdjQ7K1': { coingeckoId: 'binance-usd', decimals: 6, }, - '47cyc68FWJszCWEwMWVsD9CadjS2M1XtgANuRGbEW8UH': { coingeckoId: 'cosmos', decimals: 8, }, - '2bbGhKo5C31iEiB4CwGuqMYwjD7gCA9eXmm51fe2v8vT': { coingeckoId: 'chainlink', decimals: 8, }, - 'BLRxWVJWaVuR2CsCoTvTw2bDZ3sQLeTbCofcJv7dP5J4': { coingeckoId: 'yearn-finance', decimals: 8, }, - 'A1uMqYTzBdakuSNDv7CruWXP8mRZ4EkHwmip2RCauyZH': { coingeckoId: 'the-graph', decimals: 8, }, - '2thtesXvnVMcCnih9iZbJL3d2NQZMfzENJo8YFj6r5jU': { coingeckoId: 'terrausd', decimals: 6, }, - '2GBgdhqMjUPqreqPziXvZFSmDiQVrxNuGxR1z7ZVsm4Z': { coingeckoId: 'apecoin', decimals: 8, }, - 'Aug9ccbPApb1hxXSue8fHuvbyMf1FV1BYBtLUuS5LZnU': { coingeckoId: 'decentraland', decimals: 8, }, - 'ATQdLbehsMrmHZLNFhUm1r6s14NBT5JCFcSJGpaMrkAr': { coingeckoId: 'axie-infinity', decimals: 8, }, - '8YyrMfuBdZ5gtMWkynLTveRvGb6LJ4Aff9rpz46UUMW': { coingeckoId: 'the-sandbox', decimals: 8, }, - 'EfwRV6MuUCGgAUchdsF4dDFnSpKrDW3UYshdaDy4VBeB': { coingeckoId: 'enjincoin', decimals: 8, }, - '5zoDNRdwVXwe7DveruJGxuJnqo7SYhveDeKb8ggAuC34': { coingeckoId: 'wrapped-bitcoin', decimals: 8, }, - 'DSbbhLsSTeDg5Lsiufk2Aneh3DjVqJuPr2M9uU1gwy5p': { coingeckoId: 'vires-finance', decimals: 8, }, - // 'C1iWsKGqLwjHUndiQ7iXpdmPum9PeCDFfyXBdJJosDRS': { coingeckoId: 'duck-egg', decimals: 8, }, // fix this with right coin gecko id - '4LHHvYGNKJUg5hj65aGD5vgScvCBmLpdRFtjokvCjSL8': { coingeckoId: 'waves-enterprise', decimals: 8, }, - // 'HEB8Qaw9xrWpWs8tHsiATYGBWDBtP2S7kcPALrMu43AS': { coingeckoId: 'puzzle', decimals: 8, }, // fix this with right coin gecko id - // 'D4TPjtzpsDEJFS1pUAkvh1tJJJMNWGcSrds9sveBoQka': { coingeckoId: 'race', decimals: 8, }, - // '3UHgFQECoynwC3iunYBnbhzmcCzC5gVnVZMv8Yw1bneK': { coingeckoId: 'east', decimals: 8, }, - '6nSpVyNH7yM69eg446wrQR94ipbbcmZMU1ENPwanC97g': { coingeckoId: 'neutrino-system-base-token', decimals: 8, }, - // 'DUk2YTxhRoAqMJLus4G2b3fR8hMHVh6eiyFx5r29VR6t': { coingeckoId: 'neutrino eur', decimals: 8, }, - 'Ehie5xYpeN8op1Cctc6aGUrqx8jq3jtf1DSjXDbfm7aT': { coingeckoId: 'swop', decimals: 6, }, - '7LMV3s1J4dKpMQZqge5sKYoFkZRLojnnU49aerqos4yg': { coingeckoId: 'enno-cash', decimals: 8, }, - '9sQutD5HnRvjM1uui5cVC4w9xkMPAfYEV8ymug3Mon2Y': { coingeckoId: 'signaturechain', decimals: 8, }, - 'DHgwrRvVyqJsepd32YbBqUeDH4GJ1N984X8QoekjgH8J': { coingeckoId: 'waves-community-token', decimals: 2, }, - // 'AbunLGErT5ctzVN8MVjb4Ad9YgjpubB8Hqb17VxzfAck': { coingeckoId: 'Waves World', decimals: 0, }, - 'HZk1mbfuJpmxU1Fs4AX5MWLVYtctsNcg6e2C6VKqK8zk': { coingeckoId: 'litecoin', decimals: 8, }, - '6XtHjpXbs9RRJP2Sr9GUyVqzACcby9TkThHXnjVC5CDJ': { coingeckoId: 'usd-coin', decimals: 6, }, -} - -function fixWavesBalances(balances) { - return fixBalances(balances, wavesMapping) -} - -function fixTezosBalances(balances) { - const mapping = { - 'KT1PWx2mnDueood7fEmfbBDKx1D9BAnnXitn': { coingeckoId: 'tzbtc', decimals: 8, }, - 'tezos': { coingeckoId: 'tezos', decimals: 0, }, - 'KT1GRSvLoikDsXujKgZPsGLX8k8VvR2Tq95b': { coingeckoId: 'plenty-dao', decimals: 18, }, - 'KT1SjXiUX63QvdNMcM2m492f7kuf8JxXRLp4': { coingeckoId: 'tezos', decimals: 6, }, // this is ctez, ideally should be valued higher - 'KT1Ha4yFVeyzw6KRAdkzq6TxDHB97KG4pZe8': { coingeckoId: 'dogami', decimals: 5, }, - 'KT1JkoE42rrMBP9b2oDhbx6EUr26GcySZMUH': { coingeckoId: 'kolibri-dao', decimals: 18, }, - 'KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ-19': { coingeckoId: 'wrapped-bitcoin', decimals: 8, }, - 'KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ-17': { coingeckoId: 'usd-coin', decimals: 6, }, - 'KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ-1': { coingeckoId: 'binance-usd', decimals: 18, }, - 'KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ-20': { coingeckoId: 'ethereum', decimals: 18, }, - 'KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ-5': { coingeckoId: 'dai', decimals: 18, }, - 'KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ': { coingeckoId: 'aave', decimals: 18, }, - 'KT18fp5rcTW7mbWDmzFwjLDUhs5MeJmagDSZ-18': { coingeckoId: 'tether', decimals: 6, }, - 'KT1K9gCRgaLRFKTErYt1wVxA3Frb9FjasjTV': { coingeckoId: 'kolibri-usd', decimals: 18, }, - 'KT1LN4LPSqTMS7Sd2CJw4bbDGRkMv2t68Fy9': { coingeckoId: 'usdtez', decimals: 6, }, - 'KT1XRPEPXbZK25r3Htzp2o1x7xdMMmfocKNW': { coingeckoId: 'youves-uusd', decimals: 12, }, - // 'KT1XRPEPXbZK25r3Htzp2o1x7xdMMmfocKNW-1': { coingeckoId: 'youves-you-defi', decimals: 12, }, //uDEFI token - update gecko id here after adding in coin geckp - 'KT1Xobej4mc6XgEjDoJoHtTKgbD1ELMvcQuL': { coingeckoId: 'youves-you-governance', decimals: 12, }, - 'KT1XRPEPXbZK25r3Htzp2o1x7xdMMmfocKNW-2': { coingeckoId: 'wrapped-bitcoin', decimals: 12, }, // youves BTC - 'KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY': { coingeckoId: 'ethereum', decimals: 18, }, // plenty bridge - 'KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY-0': { coingeckoId: 'ethereum', decimals: 18, }, // plenty bridge - 'KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY-1': { coingeckoId: 'wrapped-bitcoin', decimals: 8, }, // plenty bridge - 'KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY-2': { coingeckoId: 'usd-coin', decimals: 6, }, // plenty bridge - 'KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY-3': { coingeckoId: 'tether', decimals: 6, }, // plenty bridge - 'KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY-4': { coingeckoId: 'matic-network', decimals: 18, }, // plenty bridge - 'KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY-5': { coingeckoId: 'chainlink', decimals: 18, }, // plenty bridge - 'KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY-6': { coingeckoId: 'dai', decimals: 18, }, // plenty bridge - 'KT1UsSfaXyqcjSVPeiD7U1bWgKy3taYN7NWY-7': { coingeckoId: 'binance-usd', decimals: 18, }, // plenty bridge - } - - return fixBalances(balances, mapping) -} - -const songbirdFixMapping = { - '0x02f0826ef6aD107Cfc861152B32B52fD11BaB9ED': { coingeckoId: 'songbird', decimals: 18, }, - '0xC348F894d0E939FE72c467156E6d7DcbD6f16e21': { coingeckoId: 'flare-finance', decimals: 18, }, - '0x70Ad7172EF0b131A1428D0c1F66457EB041f2176': { coingeckoId: 'usd-coin', decimals: 18, }, -} - -const smartbchFixMapping = { - '0x3743ec0673453e5009310c727ba4eaf7b3a1cc04': { coingeckoId: 'bitcoin-cash', decimals: 18, }, -} - -const evmosFixMapping = { - '0x3F75ceabcdfed1aca03257dc6bdc0408e2b4b026': { coingeckoId: 'diffusion', decimals: 18, }, - '0xd4949664cd82660aae99bedc034a0dea8a0bd517': { coingeckoId: 'evmos', decimals: 18, }, -} - -const energywebFixMapping = { - '0x6b3bd0478DF0eC4984b168Db0E12A539Cc0c83cd': { coingeckoId: 'energy-web-token', decimals: 18, }, -} - -const bittorrentFixMapping = { - '0xca424b845497f7204d9301bd13ff87c0e2e86fcf': { coingeckoId: 'usd-coin', decimals: 18, }, - '0x9b5f27f6ea9bbd753ce3793a07cba3c74644330d': { coingeckoId: 'tether', decimals: 18, }, -} - -const syscoinFixMapping = { - '0xd3e822f3ef011Ca5f17D82C956D952D8d7C3A1BB': { coingeckoId: 'syscoin', decimals: 18, }, -} - -const kavaFixMapping = { - '0xc86c7C0eFbd6A49B35E8714C5f59D99De09A225b': { coingeckoId: 'kava', decimals: 18, }, -} - -function normalizeMapping(mapping) { - Object.keys(mapping).forEach(key => mapping[key.toLowerCase()] = mapping[key]) -} - -function fixBalances(balances, mapping, { removeUnmapped = false } = {}) { - normalizeMapping(mapping) - - Object.keys(balances).forEach(token => { - const tokenKey = stripTokenHeader(token).toLowerCase() - const { coingeckoId, decimals } = mapping[tokenKey] || {} - if (!coingeckoId) { - if (removeUnmapped) { - console.log(`Removing token from balances, it is not part of whitelist: ${tokenKey}`) - delete balances[token] - } - return; - } - const currentBalance = balances[token] - delete balances[token] - sdk.util.sumSingleBalance(balances, coingeckoId, +BigNumber(currentBalance).shiftedBy(-1 * decimals)) - }) - - return balances -} - -function stripTokenHeader(token) { - token = token.toLowerCase() - return token.indexOf(':') > -1 ? token.split(':')[1] : token -} - -async function getFixBalances(chain) { - const dummyFn = i => i - return fixBalancesMapping[chain] || dummyFn -} - -const energiFixMapping = { - '0x7A86173daa4fDA903c9A4C0517735a7d34B9EC39': { coingeckoId: 'energi', decimals: 18, }, - '0xa55f26319462355474a9f2c8790860776a329aa4': { coingeckoId: 'energi', decimals: 18, }, -} - -const palmFixMapping = { - '0x4c1f6fcbd233241bf2f4d02811e3bf8429bc27b8': { coingeckoId: 'dai', decimals: 18, }, - '0x726138359c17f1e56ba8c4f737a7caf724f6010b': { coingeckoId: 'ethereum', decimals: 18, }, -} - -const ethereumFixMapping = { - '0xf6b1c627e95bfc3c1b4c9b825a032ff0fbf3e07d': { coingeckoId: 'jpyc', decimals: 18, }, - '0x97fe22e7341a0cd8db6f6c021a24dc8f4dad855f': { coingeckoId: 'jarvis-synthetic-british-pound', decimals: 18, }, - '0x0f83287ff768d1c1e17a42f44d644d7f22e8ee1d': { coingeckoId: 'upper-swiss-franc', decimals: 18, }, - '0x9fcf418b971134625cdf38448b949c8640971671': { coingeckoId: 'tether-eurt', decimals: 18, }, - '0x8751d4196027d4e6da63716fa7786b5174f04c15': { coingeckoId: 'wrapped-bitcoin', decimals: 18, }, -} - -const sxFixMapping = { - '0x90d27E008d5Db7f0a3c90a15A8Dcc4Ca18cFc670': { coingeckoId: 'sx-network', decimals: 18, }, - '0xA173954Cc4b1810C0dBdb007522ADbC182DaB380': { coingeckoId: 'ethereum', decimals: 18, }, - '0xe2aa35C2039Bd0Ff196A6Ef99523CC0D3972ae3e': { coingeckoId: 'usd-coin', decimals: 6, }, - '0xfa6F64DFbad14e6883321C2f756f5B22fF658f9C': { coingeckoId: 'matic-network', decimals: 18, }, - '0x53813CD4aCD7145A716B4686b195511FA93e4Cb7': { coingeckoId: 'dai', decimals: 18, }, - '0xa0cB58E7F783fce0F4042C790ea3045c48CD51e8': { coingeckoId: 'shark', decimals: 18, }, -} - -const meterFixMapping = { - '0xd86e243fc0007e6226b07c9a50c9d70d78299eb5': { coingeckoId: 'usd-coin', decimals: 6, }, - '0x5729cb3716a315d0bde3b5e489163bf8b9659436': { coingeckoId: 'meter', decimals: 18}, - '0x6abaedab0ba368f1df52d857f24154cc76c8c972': { coingeckoId: 'meter-stable', decimals: 18}, - '0x24aa189dfaa76c671c279262f94434770f557c35': {coingeckoId: 'binance-usd', decimals: 18}, - '0x5fa41671c48e3c951afc30816947126ccc8c162e': {coingeckoId: 'tether', decimals: 6} -} - -const fixBalancesMapping = { - avax: fixAvaxBalances, - evmos: b => fixBalances(b, evmosFixMapping, { removeUnmapped: false }), - astar: fixAstarBalances, - manta: fixMantaBalances, - shiden: fixShidenBalances, - cronos: b => fixBalances(b, cronosFixMapping, { removeUnmapped: false }), - tezos: fixTezosBalances, - harmony: fixHarmonyBalances, - hpb: fixHPBBalances, - godwoken: fixGodwokenBalances, - klaytn: fixKlaytnBalances, - waves: fixWavesBalances, - songbird: b => fixBalances(b, songbirdFixMapping, { removeUnmapped: true }), - energi: b => fixBalances(b, energiFixMapping, { removeUnmapped: true }), - smartbch: b => fixBalances(b, smartbchFixMapping, { removeUnmapped: true }), - energyweb: b => fixBalances(b, energywebFixMapping, { removeUnmapped: true }), - palm: b => fixBalances(b, palmFixMapping, { removeUnmapped: true }), - oasis: fixOasisBalances, - bittorrent: b => fixBalances(b, bittorrentFixMapping, { removeUnmapped: false }), - syscoin: b => fixBalances(b, syscoinFixMapping, { removeUnmapped: true }), - kava: b => fixBalances(b, kavaFixMapping, { removeUnmapped: false }), - ethereum: b => fixBalances(b, ethereumFixMapping, { removeUnmapped: false }), - sx: b => fixBalances(b, sxFixMapping, { removeUnmapped: true }), - meter: b => fixBalances(b, meterFixMapping, { removeUnmapped: true }), -} - -const chainTransforms = { - astar: transformAstarAddress, - fuse: transformFuseAddress, - celo: transformCeloAddress, - cronos: transformCronosAddress, - evmos: transformEvmosAddress, - fantom: transformFantomAddress, - bsc: transformBscAddress, - boba: transformBobaAddress, - polygon: transformPolygonAddress, - xdai: transformXdaiAddress, - avax: transformAvaxAddress, - heco: transformHecoAddress, - hoo: transformHooAddress, - harmony: transformHarmonyAddress, - optimism: transformOptimismAddress, - moonriver: transformMoonriverAddress, - milkomeda: transformMilkomedaAddress, - okex: transformOkexAddress, - kcc: transformKccAddress, - arbitrum: transformArbitrumAddress, - // iotex: transformIotexAddress, - metis: transformMetisAddress, - near: transformNearAddress, - moonbeam: transformMoonbeamAddress, - klaytn: transformKlaytnAddress, - velas: transformVelasAddress, - ethereum: transformEthereumAddress, - oasis: transformOasisAddress, - dfk: transformDfkAddress, - aurora: transformAuroraAddress, - findora: transformFindoraAddress, - bittorrent: transformBittorrentAddress, - reichain: transformReichainAddress, -}; - -async function transformReichainAddress() { - const mapping = { - '0xDD2bb4e845Bd97580020d8F9F58Ec95Bf549c3D9': 'bsc:0xe9e7cea3dedca5984780bafc599bd69add087d56', // killswitch busd -> busd token - '0xf8ab4aaf70cef3f3659d3f466e35dc7ea10d4a5d': 'bsc:0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c', // killswitch bnb -> bnb token - } - - return transformChainAddress(mapping, 'reichain', { skipUnmapped: true }) -} - -async function transformEthereumAddress() { - const mapping = { - '0x88536c9b2c4701b8db824e6a16829d5b5eb84440': 'polygon:0xac63686230f64bdeaf086fe6764085453ab3023f', // USV token - '0xFEEf77d3f69374f66429C91d732A244f074bdf74': '0x3432b6a60d23ca0dfca7761b7ab56459d9c964d0', // CVX FXS token - '0xb8c77482e45f1f44de1745f52c74426c631bdd52': 'bsc:0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c', // BNB - '0xeb637a9ab6be83c7f8c79fdaa62e1043b65534f0': 'heco:0xcbd6cb9243d8e3381fea611ef023e17d1b7aedf0', // BXH - '0x18a1ea69a50a85752b7bc204a2c45a95ce6e429d': 'avax:0xf30c5083a1479865c9a8916dec6ddadd82e8907b', // SPICE - '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee': '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', // ETH -> WETH - '0x18084fbA666a33d37592fA2633fD49a74DD93a88': '0x8dAEBADE922dF735c38C80C7eBD708Af50815fAa', //tBTC - '0xef779cf3d260dbe6177b30ff08b10db591a6dd9c': '0x0000000000085d4780B73119b644AE5ecd22b376', // kUSD - '0x42ef9077d8e79689799673ae588e046f8832cb95': '0x0000000000085d4780B73119b644AE5ecd22b376', //fUSD - '0x99534ef705df1fff4e4bd7bbaaf9b0dff038ebfe': '0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0', // aMATICb - '0xd3d13a578a53685b4ac36a1bab31912d2b2a2f36': '0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', // tWETH - '0x94671a3cee8c7a12ea72602978d1bb84e920efb2': '0x853d955aCEf822Db058eb8505911ED77F175b99e', // tFRAX - '0x2fc6e9c1b2c07e18632efe51879415a580ad22e1': '0x6bea7cfef803d1e3d5f7c0103f7ded065644e197', // tGAMMA - '0xeff721eae19885e17f5b80187d6527aad3ffc8de': '0xc011a73ee8576fb46f5e1c5751ca3b9fe0af2a6f', // tSNX - '0xdc0b02849bb8e0f126a216a2840275da829709b0': '0x4104b135dbc9609fc1a9490e61369036497660c8', // tAPW - '0x15a629f0665a3eb97d7ae9a7ce7abf73aeb79415': '0x9C4A4204B79dd291D6b6571C5BE8BbcD0622F050', // tTCR - '0x808d3e6b23516967ceae4f17a5f9038383ed5311': '0xc770EEfAd204B5180dF6a14Ee197D99d808ee52d', // tFOX - '0xf49764c9c5d644ece6ae2d18ffd9f1e902629777': '0x6B3595068778DD592e39A122f4f5a5cF09C90fE2', // tSUSHI - '0xd3b5d9a561c293fb42b446fe7e237daa9bf9aa84': '0xdBdb4d16EdA451D0503b854CF79D55697F90c8DF', // tALCX - '0xadf15ec41689fc5b6dca0db7c53c9bfe7981e655': '0x3432B6A60D23Ca0dFCa7761B7ab56459D9C964D0', // tFXS - '0xc7d9c108d4e1dd1484d3e2568d7f74bfd763d356': '0x0000000000085d4780B73119b644AE5ecd22b376', // XSTUSD - '0x65f7ba4ec257af7c55fd5854e5f6356bbd0fb8ec': '0x92d6c1e31e14520e676a687f0a93788b716beff5', // sDYDX - '0x586aa273f262909eef8fa02d90ab65f5015e0516': '0x0000000000085d4780B73119b644AE5ecd22b376', // FIAT - } - normalizeMapping(mapping) - - return addr => { - addr = addr.toLowerCase() - return mapping[addr] || addr - } -} - -function transformBittorrentAddress() { - const mapping = { - '0xdb28719f7f938507dbfe4f0eae55668903d34a15': '0xdac17f958d2ee523a2206206994597c13d831ec7', // USDT - '0x935faa2fcec6ab81265b301a30467bbc804b43d3': '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', // USDC - '0x8d193c6efa90bcff940a98785d1ce9d093d3dc8a': 'tron:TKfjV9RNKJJCqPvBtK8L7Knykh7DNWvnYt', // BTT - '0x17f235fd5974318e4e2a5e37919a209f7c37a6d1': '0x0c10bf8fcb7bf5412187a595ab97a3609160b5c6', // USDD - '0xae17940943ba9440540940db0f1877f101d39e8b': '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', // USDC - '0xedf53026aea60f8f75fca25f8830b7e2d6200662': 'tron:TNUC9Qb1rRpS5CbWLmNMxXBjyFoydXjWFR', // TRX - '0x1249c65afb11d179ffb3ce7d4eedd1d9b98ad006': '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', // WETH - '0xe887512ab8bc60bcc9224e1c3b5be68e26048b8b': '0xdac17f958d2ee523a2206206994597c13d831ec7', // USDT - '0xe467f79e9869757dd818dfb8535068120f6bcb97': '0xdefa4e8a7bcba345f687a2f1456f5edd9ce97202', // KNC - '0x9888221fe6b5a2ad4ce7266c7826d2ad74d40ccf': '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599', // WBTC - } - normalizeMapping(mapping) - - return addr => { - addr = addr.toLowerCase() - return mapping[addr] || addr - } -} - -async function transformMilkomedaAddress() { - const mapping = { - '0x7f27352d5f83db87a5a3e00f4b07cc2138d8ee52': 'bsc:0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c', // BNB token - // '0x0000000000000000000000000000000000000000': '' // MilkADA - '0x5950F9B6EF36f3127Ea66799e64D0ea1f5fdb9D1': '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2', // WETH - '0x41eAFC40CD5Cb904157A10158F73fF2824dC1339': '0x6B175474E89094C44Da98b954EedeAC495271d0F', // DAI - '0xab58DA63DFDd6B97EAaB3C94165Ef6f43d951fb2': '0xdAC17F958D2ee523a2206206994597C13D831ec7', // USDT - '0x5a955FDdF055F2dE3281d99718f5f1531744B102': '0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48', // USDC - '0x48AEB7584BA26D3791f06fBA360dB435B3d7A174': '0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599', // WBTC - } - - return transformChainAddress(mapping, 'milkomeda') -} - -async function transformFindoraAddress() { - const mapping = { - '0xABc979788c7089B516B8F2f1b5cEaBd2E27Fd78b': 'bsc:0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c', // BNB token - '0x008A628826E9470337e0Cd9c0C944143A83F32f3': 'bsc:0x2170ed0880ac9a755fd29b2688956bd959f933f8', // ETH token - '0x93EDFa31D7ac69999E964DAC9c25Cd6402c75DB3': 'bsc:0x55d398326f99059ff775485246999027b3197955', // USDT token - '0xdA33eF1A7b48beBbF579eE86DFA735a9529C4950': 'bsc:0x8ac76a51cc950d9822d68b83fe1ad97b32cd580d', // USDC token - '0xE80EB4a234f718eDc5B76Bb442653827D20Ebb2d': 'bsc:0xe9e7cea3dedca5984780bafc599bd69add087d56', // BUSD token - '0x07EfA82E00E458ca3D53f2CD5B162e520F46d911': 'bsc:0x7130d2a12b9bcbfae4f2634d864a1ee1ce3ead9c' // WBTC token - } - - return transformChainAddress(mapping, 'findora') -} - -function transformChainAddress(mapping, chain, { skipUnmapped = false, chainName = '' } = {}) { - normalizeMapping(mapping) - - return (addr) => { - addr = addr.toLowerCase() - if (!mapping[addr] && skipUnmapped) { - console.log('Mapping for addr %s not found in chain %s, returning garbage address', addr, chain) - return '0x1000000000000000000000000000000000000001' - } - return mapping[addr] || `${chain}:${addr}`; - } -} - -async function getChainTransform(chain) { - if (chainTransforms[chain]) - return chainTransforms[chain](); - - return (addr) => `${chain}:${addr}`; -} - -module.exports = { - getChainTransform, - getFixBalances, - transformCeloAddress, - transformCronosAddress, - transformFantomAddress, - transformBscAddress, - transformPolygonAddress, - transformXdaiAddress, - transformAvaxAddress, - transformHecoAddress, - transformHarmonyAddress, - transformOptimismAddress, - transformMoonriverAddress, - fixAvaxBalances, - transformOkexAddress, - transformKccAddress, - transformArbitrumAddress, - fixHarmonyBalances, - fixBscBalances, - fixOasisBalances, - // transformIotexAddress, - transformMetisAddress, - transformBobaAddress, - transformNearAddress, - transformMoonbeamAddress, - transformKlaytnAddress, - transformVelasAddress, - transformEthereumAddress, - transformOasisAddress, - transformOasisAddressBase, - transformMilkomedaAddress, - transformDfkAddress, - transformFindoraAddress, - wavesMapping, - stripTokenHeader, - transformBittorrentAddress -}; diff --git a/src/adapters/peggedAssets/llama-helper/processPairs.js b/src/adapters/peggedAssets/llama-helper/processPairs.js deleted file mode 100644 index 43f47482..00000000 --- a/src/adapters/peggedAssets/llama-helper/processPairs.js +++ /dev/null @@ -1,109 +0,0 @@ -const sdk = require("@defillama/sdk"); -// --- ABI's required --- -const factoryAbi = require("./abis/factory.json"); -const token0 = require("./abis/token0.json"); -const token1 = require("./abis/token1.json"); -const getReserves = require("./abis/getReserves.json"); - -async function processPairs(balances, pairNums, chain, block, factory) { - const pairs = ( - await sdk.api.abi.multiCall({ - abi: factoryAbi.allPairs, - chain, - calls: pairNums.map((num) => ({ - target: factory, - params: [num], - })), - }) - ).output; - - // --- In case pairs returns empty array, does not make sense to move down (avoid errs output) --- - if (pairs.length == 0) return; - - // --- In case that output is null will not make sense to move further (avoid errs output) --- - if (pairs[0].output == null) return; - - const pairAddresses = pairs.map((result) => result.output.toLowerCase()); - const [token0Addresses, token1Addresses, reserves] = await Promise.all([ - sdk.api.abi - .multiCall({ - abi: token0, - chain, - calls: pairAddresses.map((pairAddress) => ({ - target: pairAddress, - })), - block, - }) - .then(({ output }) => output), - sdk.api.abi - .multiCall({ - abi: token1, - chain, - calls: pairAddresses.map((pairAddress) => ({ - target: pairAddress, - })), - block, - }) - .then(({ output }) => output), - sdk.api.abi - .multiCall({ - abi: getReserves, - chain, - calls: pairAddresses.map((pairAddress) => ({ - target: pairAddress, - })), - block, - }) - .then(({ output }) => output), - ]); - - for (let n = 0; n < pairNums.length; n++) { - // --- Added try/catch block for both outputs from reserve and check null vals before --- - sdk.util.sumSingleBalance( - balances, - `${chain}:${token1Addresses[n].output}`, - reserves[n].output[1] - ); - sdk.util.sumSingleBalance( - balances, - `${chain}:${token0Addresses[n].output}`, - reserves[n].output[0] - ); - } -} - -const tvlOnPairs = async (chain, chainBlocks, factoryTarget, balances) => { - const pairLength = Number( - ( - await sdk.api.abi.call({ - target: factoryTarget, - abi: factoryAbi.allPairsLength, - chain, - block: chainBlocks[chain], - }) - ).output - ); - - const allPairNums = Array.from(Array(pairLength).keys()); - const reqs = []; - - for (let i = 0; i < pairLength; i++) { - const pairNums = allPairNums.slice(i, i + 1); - - const output = processPairs( - balances, - pairNums, - chain, - chainBlocks[chain], - factoryTarget - ); - - if (output != undefined) { - reqs.push(output); - } - } - - await Promise.all(reqs); -}; - -module.exports = tvlOnPairs; diff --git a/src/adapters/peggedAssets/llama-helper/proton.js b/src/adapters/peggedAssets/llama-helper/proton.js deleted file mode 100644 index 9402b08d..00000000 --- a/src/adapters/peggedAssets/llama-helper/proton.js +++ /dev/null @@ -1,131 +0,0 @@ -const axios = require('axios'); -const retry = require('./retry') - -const CHAIN_RPC = 'https://proton.greymass.com'; -const SWAP_CONTRACT = 'proton.swaps'; -const ORACLES_CONTRACT = 'oracles'; - -async function getTableRows({ - json = true, - code, - scope, - table, - lower_bound = '', - upper_bound = '', - index_position = 1, - key_type = '', - limit = -1, - reverse = false, - show_payer = false, -}) { - try { - const { data } = await axios.default.post( - CHAIN_RPC + '/v1/chain/get_table_rows', - JSON.stringify({ - json, - code, - scope, - table, - lower_bound, - upper_bound, - index_position, - key_type, - limit, - reverse, - show_payer, - }) - ); - return data; - } catch (e) { - console.error(e); - } -} - - -async function getFullTable ({ - code, - scope, - table, - lower_bound, - upper_bound, -}) { - let { rows, more, next_key } = await getTableRows({ - code, - scope, - table, - lower_bound, - upper_bound, - limit: -1 - }) - - if (more) { - rows = rows.concat(await getFullTable({ - code, - scope, - table, - lower_bound: next_key, - upper_bound - })) - } - - return rows -} - -async function getCurrencyBalance(code, account, symbol) { - try { - const { data } = await axios.default.post( - CHAIN_RPC + '/v1/chain/get_currency_balance', - JSON.stringify({ - code, - account, - symbol - }) - ); - return data; - } catch (e) { - console.error(e); - } -} - -async function getAllOracleData(lower_bound) { - try { - return await getFullTable({ - code: ORACLES_CONTRACT, - scope: ORACLES_CONTRACT, - table: 'data', - limit: -1, - lower_bound: lower_bound, - }); - } catch (e) { - return []; - } -} - -async function getAllSwapPools(lower_bound) { - try { - return await getFullTable({ - code: SWAP_CONTRACT, - scope: SWAP_CONTRACT, - table: 'pools', - limit: -1, - lower_bound: lower_bound, - }); - } catch (e) { - return []; - } -} - -async function getTokenPriceUsd(tokenSymbol, tokenContract) { - const { data: tokens } = await axios.get('https://api.protonchain.com/v1/chain/exchange-rates/info') - const token = tokens.find(token => token.symbol === tokenSymbol && token.contract === tokenContract) - const exchangeRate = token.rates.find(rate => rate.counterCurrency === 'USD') - return exchangeRate.price -} - -module.exports = { - getTableRows, - getCurrencyBalance, - getAllOracleData, - getAllSwapPools, - getTokenPriceUsd -} \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/requery.js b/src/adapters/peggedAssets/llama-helper/requery.js deleted file mode 100644 index 8b2cad98..00000000 --- a/src/adapters/peggedAssets/llama-helper/requery.js +++ /dev/null @@ -1,22 +0,0 @@ -const sdk = require('@defillama/sdk'); - -async function requery(resultsRaw, chain, block, abi) { - const results = resultsRaw.output; - if (results.some(r => !r.success)) { - const failed = results.map((r, i) => [r, i]).filter(r => !r[0].success) - const newResults = await sdk.api.abi - .multiCall({ - abi, - chain, - calls: failed.map((f) => f[0].input), - block, - }).then(({ output }) => output); - failed.forEach((f, i) => { - results[f[1]] = newResults[i] - }) - } -} - -module.exports = { - requery -} \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/resolveCrvTokens.js b/src/adapters/peggedAssets/llama-helper/resolveCrvTokens.js deleted file mode 100644 index 2aeecaa6..00000000 --- a/src/adapters/peggedAssets/llama-helper/resolveCrvTokens.js +++ /dev/null @@ -1,202 +0,0 @@ - -const sdk = require('@defillama/sdk') -const BigNumber = require('bignumber.js') - -const curvePoolsPartial = require('../convex/pools-crv') -const abi = require('../concentrator/abis/abi.json') -const AladdinCRVABI = require('../concentrator/abis/AladdinCRV.json') -const crvPools = require('./curvePools') - -const replacements = [ - '0x99d1Fa417f94dcD62BfE781a1213c092a47041Bc', - '0x9777d7E2b60bB01759D0E2f8be2095df444cb07E', - '0x1bE5d71F2dA660BFdee8012dDc58D024448A0A59', - '0x16de59092dAE5CcF4A1E6439D611fd0653f0Bd01', - '0xd6aD7a6750A7593E092a9B218d66C0A814a3436e', - '0x83f798e925BcD4017Eb265844FDDAbb448f1707D', - '0x73a052500105205d34Daf004eAb301916DA8190f' -] - -const curvePools = [ - { - assets: 'Curve.fi Factory USD Metapool: moUSD', - isLendingPool: true, - coins: ['0x60d55f02a771d515e077c9c2403a1ef324885cec', '0x27f8d03b3a2196956ed754badc28d73be8830a6e', '0x1a13f4ca1d028320a707d99520abfefca3998b7f'], - addresses: { - swap: '0x445fe580ef8d70ff569ab36e80c647af338db351', - lpToken: '0xe7a24ef0c5e95ffb0f6684b813a78f2a3ad7d171', - gauge: '0x19793b454d3afc7b454f206ffe95ade26ca6912c', - }, - } -] - -const gaugeLPMapping = {} - -Object.keys(crvPools).forEach(key => crvPools[key.toLowerCase()] = crvPools[key]) - -const curveLPMapping = [...curvePoolsPartial, ...curvePools].reduce((accum, poolData) => { - accum[poolData.addresses.lpToken.toLowerCase()] = poolData - if (poolData.addresses.gauge) { - const gaugeToken = poolData.addresses.gauge.toLowerCase() - gaugeLPMapping[gaugeToken] = poolData.addresses.lpToken - accum[gaugeToken] = poolData - } - return accum -}, {}) - - -async function unwrapCrvKnown(balances, crvToken, lpBalance, block, chain = 'ethereum', transformAddress = (addr) => addr, excludeTokensRaw = []) { - crvToken = stripChainHeader(crvToken).toLowerCase() - const excludeTokens = excludeTokensRaw.map(addr => addr.toLowerCase()) - if (crvPools[crvToken] === undefined) - return; - - const crvSwapContract = crvPools[crvToken].swapContract - const underlyingTokens = crvPools[crvToken].underlyingTokens - const crvTotalSupply = sdk.api.erc20.totalSupply({ - target: crvToken, - block, - chain - }) - const underlyingSwapTokens = (await sdk.api.abi.multiCall({ - calls: underlyingTokens.map(token => ({ - target: token, - params: [crvSwapContract] - })), - block, - chain, - abi: 'erc20:balanceOf' - })).output - - // steth and seth case where balanceOf not applicable on ETH balance - if (crvToken.toLowerCase() === '0x06325440d014e39736583c165c2963ba99faf14e' || crvToken.toLowerCase() === '0xa3d87fffce63b53e0d54faa1cc983b7eb0b74a9c') { - underlyingSwapTokens[0].output = underlyingSwapTokens[0].output * 2 - } - - const resolvedCrvTotalSupply = (await crvTotalSupply).output - underlyingSwapTokens.forEach(call => { - if (excludeTokens.includes(call.input.target.toLowerCase())) return; - const underlyingBalance = BigNumber(call.output).times(lpBalance).div(resolvedCrvTotalSupply) - sdk.util.sumSingleBalance(balances, transformAddress(call.input.target), underlyingBalance.toFixed(0)) - }) -} - -const cGaugeMapping = { - avax: { - '0x5b5cfe992adac0c9d48e05854b2d91c73a003858': '0x1337BedC9D22ecbe766dF105c9623922A27963EC', - }, - polygon: { - '0x19793b454d3afc7b454f206ffe95ade26ca6912c': '0xe7a24ef0c5e95ffb0f6684b813a78f2a3ad7d171', - } -} -Object.values(cGaugeMapping).forEach(mapping => Object.keys(mapping).forEach(key => mapping[key.toLowerCase()] = mapping[key])) - -async function unwrapCrv(balances, crvToken, lpBalance, block, chain = 'ethereum', transformAddress = (addr) => addr) { - crvToken = stripChainHeader(crvToken).toLowerCase() - const gaugeMap = cGaugeMapping[chain] || {} - if (gaugeMap[crvToken]) crvToken = gaugeMap[crvToken] - - if (crvPools[crvToken]) return unwrapCrvKnown(...arguments) - - const poolData = curveLPMapping[crvToken] - - if (!poolData) return balances - const swapAddress = poolData.addresses.swap - - const coinCalls = [...Array(Number(poolData.coins.length)).keys()].map(num => { - return { - target: swapAddress, - params: [num] - } - }) - - const coinsUint = sdk.api.abi.multiCall({ - abi: abi.coinsUint, - calls: coinCalls, - block, chain, - }) - - const coinsInt = sdk.api.abi.multiCall({ - abi: abi.coinsInt, - calls: coinCalls, - block, chain, - }) - - let coins = await coinsUint - if (!coins.output[0].success) { - coins = await coinsInt - } - const coinBalances = await sdk.api.abi.multiCall({ - abi: 'erc20:balanceOf', - calls: coins.output.map(coin => ({ - target: coin.output, - params: [swapAddress] - })), - block, chain, - }) - const totalSupply = (await sdk.api.abi.call({ - target: gaugeLPMapping[crvToken] ? gaugeLPMapping[crvToken] : crvToken, - block, - chain, - abi: AladdinCRVABI.totalSupply, - params: [] - })).output - - await Promise.all(coinBalances.output.map(async (coinBalance, index) => { - let coinAddress = coins.output[index].output - if (replacements.includes(coinAddress)) { - coinAddress = '0x6b175474e89094c44da98b954eedeac495271d0f' // dai - } - if (coinBalance.input.target === '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE') { - coinBalance = await sdk.api.eth.getBalance({ - target: coinBalance.input.params[0], - block, chain, - }) - coinAddress = '0x0000000000000000000000000000000000000000' - } - - const balance = BigNumber(lpBalance).times(coinBalance.output).div(totalSupply) - if (!balance.isZero()) { - sdk.util.sumSingleBalance(balances, transformAddress(coinAddress), balance.toFixed(0)) - } - })) - - return balances -} - -function stripChainHeader(token) { - return token.indexOf(':') > -1 ? token.split(':')[1] : token -} - - -function getCrvTokens(balances) { - return Object.keys(balances) - .filter(isCrvToken) - .map(token => ({ token, balance: balances[token] })) - - function isCrvToken(token) { - token = stripChainHeader(token).toLowerCase() - return crvPools[token] || curveLPMapping[token] - } -} - -async function resolveCrvTokens(balances, block, chain = 'ethereum', transformAddress = (addr) => addr) { - let crvTokens = getCrvTokens(balances) - let count = 0 - while (crvTokens.length && count < 6) { - crvTokens.forEach(({ token }) => delete balances[token]) - await Promise.all(crvTokens.map(({ token, balance }) => - unwrapCrv(balances, token, balance, block, chain, transformAddress))) - crvTokens = getCrvTokens(balances) - count++ - } - - if (crvTokens.length) - console.log('unresolved crv tokens:', crvTokens) - return balances -} - -module.exports = { - unwrapCrv, - resolveCrvTokens, -} \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/retry.js b/src/adapters/peggedAssets/llama-helper/retry.js deleted file mode 100644 index 8f05c4e6..00000000 --- a/src/adapters/peggedAssets/llama-helper/retry.js +++ /dev/null @@ -1,9 +0,0 @@ -const retryModule = require('async-retry') - -async function retry(func){ - return retryModule(func, { - retries:3 - }) -} - -module.exports = retry \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/solana.js b/src/adapters/peggedAssets/llama-helper/solana.js deleted file mode 100644 index a655d1ce..00000000 --- a/src/adapters/peggedAssets/llama-helper/solana.js +++ /dev/null @@ -1,41 +0,0 @@ -const axios = require("axios"); - -const endpoint = process.env.SOLANA_RPC ?? "https://api.mainnet-beta.solana.com"; - -async function getTokenSupply(token) { - const tokenSupply = await axios.post(endpoint, { - jsonrpc: "2.0", - id: 1, - method: "getTokenSupply", - params: [token], - }); - return tokenSupply.data.result.value.uiAmount; -} - -async function getTokenBalance(token, account) { - const tokenBalance = await axios.post(endpoint, { - jsonrpc: "2.0", - id: 1, - method: "getTokenAccountsByOwner", - params: [ - account, - { - mint: token, - }, - { - encoding: "jsonParsed", - }, - ], - }); - return tokenBalance.data.result.value.reduce( - (total, account) => - total + account.account.data.parsed.info.tokenAmount.uiAmount, - 0 - ); -} - -module.exports = { - getTokenSupply, - getTokenBalance, - endpoint -}; diff --git a/src/adapters/peggedAssets/llama-helper/staking.js b/src/adapters/peggedAssets/llama-helper/staking.js deleted file mode 100644 index 037d20c0..00000000 --- a/src/adapters/peggedAssets/llama-helper/staking.js +++ /dev/null @@ -1,93 +0,0 @@ -const sdk = require('@defillama/sdk'); -const { getBlock } = require('./getBlock'); -const getReserves = require('./abis/getReserves.json'); -const token0Abi = require('./abis/token0.json'); -const token1Abi = require('./abis/token1.json'); -const { default: BigNumber } = require('bignumber.js'); -const { getChainTransform, getFixBalances, } = require('./portedTokens') - - -function staking(stakingContract, stakingToken, chain = "ethereum", transformedTokenAddress = undefined, decimals = undefined) { - return stakings([stakingContract], stakingToken, chain, transformedTokenAddress, decimals) -} - -function stakings(stakingContracts, stakingToken, chain = "ethereum", transformedTokenAddress = undefined, decimals = undefined) { - return async (timestamp, _ethBlock, chainBlocks) => { - const block = await getBlock(timestamp, chain, chainBlocks) - const bal = (await sdk.api.abi.multiCall({ - calls: stakingContracts.map(c => ({ target: stakingToken, params: [c] })), - chain, - block, - abi: "erc20:balanceOf" - })).output.reduce((total, call)=> BigNumber(total).plus(call.output).toFixed(0), "0") - let address = stakingToken; - if (transformedTokenAddress) { - address = transformedTokenAddress - } else { - address = (await getChainTransform(chain))(stakingToken) - } - if (decimals !== undefined) { - return { - [address]: Number(bal) / (10 ** decimals) - } - } - return { - [address]: bal - } - } -} - -function stakingPricedLP(stakingContract, stakingToken, chain, lpContract, coingeckoIdOfPairedToken, stakedTokenIsToken0 = false, decimals=18) { - return stakingUnknownPricedLP(stakingContract, stakingToken, chain, lpContract, ()=>coingeckoIdOfPairedToken, decimals) -} - -function stakingUnknownPricedLP(stakingContract, stakingToken, chain, lpContract, transform, decimals) { - return async (timestamp, _ethBlock, chainBlocks) => { - if (!transform) transform = await getChainTransform(chain) - - const block = await getBlock(timestamp, chain, chainBlocks, true) - const [bal, reserveAmounts, token0, token1] = await Promise.all([ - sdk.api.erc20.balanceOf({ - target: stakingToken, - owner: stakingContract, - chain, - block, - }), - ...[getReserves, token0Abi, token1Abi].map(abi=>sdk.api.abi.call({ - target: lpContract, - abi, - chain, - block - }).then(o=>o.output)) - ]) - let token, stakedBal; - if(token0.toLowerCase() === stakingToken.toLowerCase()){ - token = token1; - stakedBal = BigNumber(bal.output).times(reserveAmounts[1]).div(reserveAmounts[0]).toFixed(0); - }else { - stakedBal = BigNumber(bal.output).times(reserveAmounts[0]).div(reserveAmounts[1]).toFixed(0); - token = token0 - } - if(decimals !== undefined){ - stakedBal = Number(stakedBal)/(10**decimals) - } - - const balances = { - [transform(token)]: stakedBal - } - - if (['klaytn', 'kava'].includes(chain)) { - const fixBalances = await getFixBalances(chain) - fixBalances(balances) - } - - return balances - } -} - -module.exports = { - staking, - stakings, - stakingPricedLP, - stakingUnknownPricedLP -} diff --git a/src/adapters/peggedAssets/llama-helper/sui.js b/src/adapters/peggedAssets/llama-helper/sui.js deleted file mode 100644 index 4d1d599a..00000000 --- a/src/adapters/peggedAssets/llama-helper/sui.js +++ /dev/null @@ -1,23 +0,0 @@ -const axios = require("axios"); - -const endpoint = "https://fullnode.mainnet.sui.io/"; - -async function getTokenSupply(token) { - const { data: { result: { decimals } } } = await axios.post(endpoint, { - "jsonrpc": "2.0", - "id": 1, - "method": "suix_getCoinMetadata", - "params": [token] - }); - const { data: { result: { value: supply } } } = await axios.post(endpoint, { - "jsonrpc": "2.0", - "id": 1, - "method": "suix_getTotalSupply", - "params": [token] - }); - return supply / 10 ** decimals; -} - -module.exports = { - getTokenSupply, -}; diff --git a/src/adapters/peggedAssets/llama-helper/sunny-pools.json b/src/adapters/peggedAssets/llama-helper/sunny-pools.json deleted file mode 100644 index 478cae38..00000000 --- a/src/adapters/peggedAssets/llama-helper/sunny-pools.json +++ /dev/null @@ -1,1136 +0,0 @@ -[ - { - "poolName": "Saber_USDT-USDC", - "relevantAccounts": { - "sunnyPool": "DgCMFSzZzZBnyFTmEiX1zfsugckBLyyX79YUgZr9XCf7", - "tokenAMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", - "tokenBMint": "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB", - "tokenAReserve": "CfWX7o2TswwbxusJ4hCaPobu2jLCb1hfXuXJQjVq3jQF", - "tokenBReserve": "EnTrdMMpdhugeH6Ban6gYZWXughWxKtVGfCwFn78ZmY3", - "lpTokenSPL": "2poo1w1DL6yd2WNTCnNTzDqkC6MBXq7axo77P16yrBuf" - }, - "tokenA": "usd-coin", - "tokenB": "tether", - "tvlReader": "sunnySaberPoolReader" - }, - { - "poolName": "Saber_mSOL-SOL", - "relevantAccounts": { - "sunnyPool": "F8Tguj5VBWCrYzUPztETok5X78LR7djdrMtaorYhawgw", - "tokenAMint": "mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So", - "tokenBMint": "So11111111111111111111111111111111111111112", - "tokenAReserve": "9DgFSWkPDGijNKcLGbr3p5xoJbHsPgXUTr6QvGBJ5vGN", - "tokenBReserve": "2hNHZg7XBhuhHVZ3JDEi4buq2fPQwuWBdQ9xkH7t1GQX", - "lpTokenSPL": "SoLEao8wTzSfqhuou8rcYsVoLjthVmiXuEjzdNPMnCz" - }, - "tokenA": "solana", - "tokenB": "solana", - "tvlReader": "sunnySaberPoolReader" - }, - { - "poolName": "Saber_PAI-USDC", - "relevantAccounts": { - "sunnyPool": "GHhWVFF4kPvvz7qxtTi6uTr6nDoC1Ho7ZrKYTNZirVRj", - "tokenAMint": "Ea5SjE2Y6yvCeW5dYTn7PYMuW5ikXkvbGdcmSnXeaLjS", - "tokenBMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", - "tokenAReserve": "4DYwgJtxwuJdAjkj5RJSNH4e7U329V5cNp7d3a1nLrZv", - "tokenBReserve": "EXNW64GEf1ACC6xY9BtKRiunrs6GoJSXBdxWN2eTPmrF", - "lpTokenSPL": "PaiYwHYxr4SsEWox9YmyBNJmxVG7GdauirbBcYGB7cJ" - }, - "tokenA": "dai", - "tokenB": "usd-coin", - "tvlReader": "sunnySaberPoolReader" - }, - { - "poolName": "Saber_BTC-renBTC", - "relevantAccounts": { - "sunnyPool": "22NmJEkjSUzvtagiau2JEwXdo9pc9UgZJX1BZiRJimaH", - "tokenAMint": "CDJWUqTcYTVAKXAVXoQZFes5JUFc7owSeq7eMQcDSbo5", - "tokenBMint": "SBTCB6pWqeDo6zGi9WVRMLCsKsN6JiR1RMUqvLtgSRv", - "tokenAReserve": "35yX27bmurdebhfAb8EPmjLETDiUaEUCn9zHaDPbakH2", - "tokenBReserve": "2CxECn1ZJFoESyUnQysQU8rRgT3iJ5GRs2Mdd6gZjx5g", - "lpTokenSPL": "SLPbsNrLHv8xG4cTc4R5Ci8kB9wUPs6yn6f7cKosoxs" - }, - "tokenA": "renbtc", - "tokenB": "bitcoin", - "tvlReader": "sunnySaberPoolReader" - }, - { - "poolName": "Saber_pBTC-renBTC", - "relevantAccounts": { - "sunnyPool": "EGig51WPpRrVknLmZYiTfba93w31sGCFMApRzHcAwmKr", - "tokenAMint": "CDJWUqTcYTVAKXAVXoQZFes5JUFc7owSeq7eMQcDSbo5", - "tokenBMint": "DYDWu4hE4MN3aH897xQ3sRTs5EAjJDmQsKLNhbpUiKun", - "tokenAReserve": "DvHVapj4g2Y1tJVSw2ubSPkPBsJPb8fW387ZWXwaKmZq", - "tokenBReserve": "DKjqWWgrtDRPKrnMWtZ4UiJk4sGQVCQgFjSo7BvfngvK", - "lpTokenSPL": "pBTCmyG7FaZx4uk3Q2pT5jHKWmWDn84npdc7gZXpQ1x" - }, - "tokenA": "renbtc", - "tokenB": "bitcoin", - "tvlReader": "sunnySaberPoolReader" - }, - { - "poolName": "Saber_UST-USDC", - "relevantAccounts": { - "sunnyPool": "CmV2Cppe7EoqhGvsMws3bFs5iStm5gmDmejJvaRT2uco", - "tokenAMint": "JEFFSQ3s8T3wKsvp4tnRAsUBW7Cqgnf8ukBZC4C8XBm1", - "tokenBMint": "CXLBjMMcwkc17GfJtBos6rQCo1ypeH6eDbB82Kby4MRm", - "tokenAReserve": "D9yh4KAysxt9GLacVe4Wwh2XqghhcjTCSTV9HuM7TBJd", - "tokenBReserve": "HDYfJLpZKaMFb84jM4mRytn7XLR8UFZUnQpSfhJJaNEy", - "lpTokenSPL": "UST32f2JtPGocLzsL41B3VBBoJzTm1mK1j3rwyM3Wgc" - }, - "tokenA": "usd-coin", - "tokenB": "terrausd", - "tvlReader": "sunnySaberPoolReader" - }, - { - "poolName": "Saber_wDAI-USDC", - "relevantAccounts": { - "sunnyPool": "BtxevLdCyhHJhhMo1dvcXBvt5RB3FWSv4P6knkeTf6wT", - "tokenAMint": "FYpdBuyAHSbdaAyD1sKkxyLWbAP8uUW9h6uvdhK74ij1", - "tokenBMint": "JEFFSQ3s8T3wKsvp4tnRAsUBW7Cqgnf8ukBZC4C8XBm1", - "tokenAReserve": "A7VkMFrnCCyeZFUrQ3TzDr4xFep7PZtxvy3jJnBjLB2a", - "tokenBReserve": "PhfHJ2Yu99BsEjZrefhApqUnLUiExcECcUT1YLoNUUv", - "lpTokenSPL": "Daimhb91DY4e3aVaa7YCW5GgwaMT9j1ALSi2GriBvDNh" - }, - "tokenA": "dai", - "tokenB": "usd-coin", - "tvlReader": "sunnySaberPoolReader" - }, - { - "poolName": "Saber_wBUSD-USDC", - "relevantAccounts": { - "sunnyPool": "HmW1eg5XhWTk7a42Vmd2SmHMeBxxphkcS6abAec6Pg1g", - "tokenAMint": "AJ1W9A9N9dEMdVyoDiam2rV44gnBm2csrPDP7xqcapgX", - "tokenBMint": "JEFFSQ3s8T3wKsvp4tnRAsUBW7Cqgnf8ukBZC4C8XBm1", - "tokenAReserve": "5uerVwBnZQsuVhZ15igs7ZgmcqhHnYWbwoRtLyRqLvR", - "tokenBReserve": "9YWiQh5d4jCtgMdzcGLv9bWgnLaFtzvDDh2nnhJdzhBX", - "lpTokenSPL": "BUSDaZjarCrQJLeHpWi7aLaKptdR1S8DFpwdDuuZu9p3" - }, - "tokenA": "busd", - "tokenB": "usd-coin", - "tvlReader": "sunnySaberPoolReader" - }, - { - "poolName": "Saber_wLUNA-renLUNA", - "relevantAccounts": { - "sunnyPool": "4rDTvyrzLXYPHEweNnVLtEyCnMJ5UfMjAcsMSkfgECvF", - "tokenAMint": "2Xf2yAXJfg82sWwdLUo2x9mZXy6JCdszdMZkcF1Hf4KV", - "tokenBMint": "KUANeD8EQvwpT1W7QZDtDqctLEh2FfSTy5pThE9CogT", - "tokenAReserve": "Au5zcSost9sXpH8AQQjULRXJ9QCJ3kdKehUr1zYzTr6G", - "tokenBReserve": "Gx1L7n1YhDWLNfUyCeZfzKvwHJSxhppnk4DS5cZLqyd", - "lpTokenSPL": "LUNkiLcb2wxcqULmJvMjuM6YQhpFBadG5KZBe7qBpSE" - }, - "tokenA": "terra-luna", - "tokenB": "terra-luna", - "tvlReader": "sunnySaberPoolReader" - }, - { - "poolName": "Saber_wFRAX-USDC", - "relevantAccounts": { - "sunnyPool": "oGS5V292ry3XwqDooaqnHgxedKNvEQ5mtrG3cYba2ah", - "tokenAMint": "8L8pDf3jutdpdr4m3np68CL9ZroLActrqwxi6s9Ah5xU", - "tokenBMint": "JEFFSQ3s8T3wKsvp4tnRAsUBW7Cqgnf8ukBZC4C8XBm1", - "tokenAReserve": "7eEYpq6ShaJ9opZWMxitRFrdCHh6vfyHhGfoSvFht3N2", - "tokenBReserve": "H8VggnHmuwd1wvwpT8eg9cUJFEfZ7HAaeYjgXrSm7A2u", - "lpTokenSPL": "FRAXXvt2ucEsxYPK4nufDy5zKhb2xysieqRBE1dQTqnK" - }, - "tokenA": "frax", - "tokenB": "usd-coin", - "tvlReader": "sunnySaberPoolReader" - }, - { - "poolName": "Saber_HBTC-renBTC", - "relevantAccounts": { - "sunnyPool": "7mzgsXmiqhwWybEnbDAWJdYff6PWRq4TB8voUWbe1gce", - "tokenAMint": "8pBc4v9GAwCBNWPB5XKA93APexMGAS4qMr37vNke9Ref", - "tokenBMint": "FACTQhZBfRzC7A76antnpAoZtiwYmUfdAN8wz7e8rxC5", - "tokenAReserve": "GsizhiRtCs4QDKd2LnSQ9BpzvG8CqERMDtHZcQPDkFQB", - "tokenBReserve": "CRaJHfCry6JShmF4tMr6siR2D2QNNfcUrLawTqPVCTTJ", - "lpTokenSPL": "HBTCNvkwjMsEtwe2PeXUuMcu8C4Hobw6HDP2m6vpWHGo" - }, - "tokenA": "bitcoin", - "tokenB": "bitcoin", - "tvlReader": "sunnySaberPoolReader" - }, - { - "poolName": "Saber_HUSD-USDC", - "relevantAccounts": { - "sunnyPool": "MJj6148HLjiahjcv1b83NZ8j4YNCnKN5wJ8urMir5Vh", - "tokenAMint": "BybpSTBoZHsmKnfxYG47GDhVPKrnEKX31CScShbrzUhX", - "tokenBMint": "88881Hu2jGMfCs9tMu5Rr7Ah7WBNBuXqde4nR5ZmKYYy", - "tokenAReserve": "2mUxDu8NrhSKhQJMgKfYLxJqZzeEbmwhQdHeHMyohyuk", - "tokenBReserve": "AZCBmDBcFsA2jHHhfFJBTsWCHx9XnnKmGfFsue3ZVW1t", - "lpTokenSPL": "HUSDgP5YieANhAAHD42yivX9aFS1zbodTut2Dvvkj8QS" - }, - "tokenA": "husd", - "tokenB": "usd-coin", - "tvlReader": "sunnySaberPoolReader" - }, - { - "poolName": "Saber_USDK-USDC", - "relevantAccounts": { - "sunnyPool": "6UaNyeYKzP7zzUwPN3SCQYRjE438akKTVa9VU7cSj5C9", - "tokenAMint": "2kycGCD8tJbrjJJqWN2Qz5ysN9iB4Bth3Uic4mSB7uak", - "tokenBMint": "JEFFSQ3s8T3wKsvp4tnRAsUBW7Cqgnf8ukBZC4C8XBm1", - "tokenAReserve": "5RfXYWvxR9PUaedokXVxgJHDoD4xnLLauVtdJ27shPWG", - "tokenBReserve": "DJcFPaQjyW9Xkt7sXCbnEGj1yfykGYuLRUXFyS4LLZ5F", - "lpTokenSPL": "uSdKg2Cs5bCtFSeNXs7aRVNzZJauX58eCkdsfssxTdW" - }, - "tokenA": "usdk", - "tokenB": "usd-coin", - "tvlReader": "sunnySaberPoolReader" - }, - { - "poolName": "Saber_wFTT-FTT", - "relevantAccounts": { - "sunnyPool": "9qQVQfDFGqRw6HHvcZfHVTdJgqsgyLS6jY5LU38GkkP5", - "tokenAMint": "GbBWwtYTMPis4VHb8MrBbdibPhn28TSrLB53KvUmb7Gi", - "tokenBMint": "FTT9rBBrYwcHam4qLvkzzzhrsihYMbZ3k6wJbdoahxAt", - "tokenAReserve": "46xwHtnXoQR3wCHUbm2eCAbPYWbioDQ59Te1Db8M5DDL", - "tokenBReserve": "FC38fiikZwFvDt5zTjNtGfKd7LjaPz2uUAzLwKP5pRJY", - "lpTokenSPL": "FTXdV5wFFhceKjcd1JRrRQTT2uB7ruMerAqbj2rj1Mz7" - }, - "tokenA": "ftx-token", - "tokenB": "ftx-token", - "tvlReader": "sunnySaberPoolReader" - }, - { - "poolName": "Saber_wSRM-SRM", - "relevantAccounts": { - "sunnyPool": "4Hn4AvnbQAsCytdPSmFJFtAzsVpGM3XaJsqNZo9TRgMG", - "tokenAMint": "2jXy799YnEcRXneFo2GEAB6SDRsAa767HpWmktRr1DaP", - "tokenBMint": "SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt", - "tokenAReserve": "C5uYkVHiFduEFq8S3fr4pgUS24oYj1sjZ8WW2cb4j8SU", - "tokenBReserve": "3F5DPU5ScgHiFzePYUHZovvgh3uqmM5keNvbavx2ERqV", - "lpTokenSPL": "SRMKjSJpBHJ5gSVTrimci49SnXc1LVkBi9TGF9RNYdp" - }, - "tokenA": "serum", - "tokenB": "serum", - "tvlReader": "sunnySaberPoolReader" - }, - { - "poolName": "Saber_ibBTC-renBTC", - "relevantAccounts": { - "sunnyPool": "JCskJBoq3itLVHa6RF8mdDJ3htqh8q1APWKhisEYG29b", - "tokenAMint": "66CgfJQoZkpkrEgC1z4vFJcSFc4V6T5HqbjSSNuqcNJz", - "tokenBMint": "FACTQhZBfRzC7A76antnpAoZtiwYmUfdAN8wz7e8rxC5", - "tokenAReserve": "CZ48nQQ6GK8Z7hGBPdxTtMzRBA8werj5iciVJnc3vz1S", - "tokenBReserve": "G3nLYyvP46npva5MEobZVJhcDNzJ4rrHgLGJMtvyad5c", - "lpTokenSPL": "BRENm9SgYJZuCxM4ZJiH6CmZqEBn4MLpD9cnBZDnJgeT" - }, - "tokenA": "bitcoin", - "tokenB": "bitcoin", - "tvlReader": "sunnySaberPoolReader" - }, - { - "poolName": "Saber_apUSDT-USDT", - "relevantAccounts": { - "sunnyPool": "7pQLXy3befFLSszHBkH9zpkhptEK6H8FEeEZRCXVTikS", - "tokenAMint": "DNhZkUaxHXYvpxZ7LNnHtss8sQgdAfd1ZYS1fB7LKWUZ", - "tokenBMint": "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB", - "tokenAReserve": "D6d156U1bPiJpDYRLextvDRccgFk7QzkQbJg42ceKEu5", - "tokenBReserve": "GNcM8U5g8RwTZffwwm3kSQqUNPSwv5d2fbN9sLxPJqt2", - "lpTokenSPL": "PLYJZgSkcV8UXTWhTyf2WLCMeBoZum1Y4rXgXkoYiNj" - }, - "tokenA": "tether", - "tokenB": "tether", - "tvlReader": "sunnySaberPoolReader" - }, - { - "poolName": "Saber_MAI-USDC", - "relevantAccounts": { - "sunnyPool": "6UQSBG9p7Z9Tu9CTnQaYTyjP4r7CdV9yHDj8UojguNvA", - "tokenAMint": "9mWRABuz2x6koTPCWiCPM49WUbcrNqGTHBV9T9k7y1o7", - "tokenBMint": "JEFFSQ3s8T3wKsvp4tnRAsUBW7Cqgnf8ukBZC4C8XBm1", - "tokenAReserve": "DhgiEgiNdqZdRdo195UUHnoEJUtefK8buko8nU97XJUZ", - "tokenBReserve": "2K2kkXsouBHtWVjtcgkyiXd8eP3oVBvq1bTJzcVdLLr2", - "lpTokenSPL": "MAiP3Zmjhc6NYiCb2xK2893ifvTTDHciCS57Kga39pC" - }, - "tokenA": "dai", - "tokenB": "usd-coin", - "tvlReader": "sunnySaberPoolReader" - }, - { - "poolName": "Saber_prtSOL-SOL", - "relevantAccounts": { - "sunnyPool": "8U9eJKhA93ULi8U7CdEdAa93PQWxHCa7xYHTzpHoym1W", - "tokenAMint": "BdZPG9xWrG3uFrx2KrUW1jT4tZ9VKPDWknYihzoPRJS3", - "tokenBMint": "So11111111111111111111111111111111111111112", - "tokenAReserve": "9ZDpBKPqMABtGfq66FbVribaArMvtk63xxy91onZAtDt", - "tokenBReserve": "9ZDpBKPqMABtGfq66FbVribaArMvtk63xxy91onZAtDt", - "lpTokenSPL": "PrsVdKtXDDf6kJQu5Ff6YqmjfE4TZXtBgHM4bjuvRnR" - }, - "tokenA": "solana", - "tokenB": "solana", - "tvlReader": "sunnySaberPoolReader" - }, - { - "poolName": "Saber_pSOL-prtSOL", - "relevantAccounts": { - "sunnyPool": "2z83EUtVrU27aL9hVvRmRaH1tRRW5qe2pE5joY8CyttA", - "tokenAMint": "9EaLkQrbjmbbuZG9Wdpo8qfNUEjHATJFSycEmw6f1rGX", - "tokenBMint": "BdZPG9xWrG3uFrx2KrUW1jT4tZ9VKPDWknYihzoPRJS3", - "tokenAReserve": "3oyc6hpjYSJEquK6dSvG72NXyz3pqLZz5D8AC71pwgQb", - "tokenBReserve": "Di2vordgFJVZ1aj1aBpvzXtLfZgJsuLLXawGtVFwX6Rz", - "lpTokenSPL": "PSopTFPXzTRysj2H6W8oTvYBZmJHtRcVaQaDkckifAy" - }, - "tokenA": "solana", - "tokenB": "solana", - "tvlReader": "sunnySaberPoolReader" - }, - { - "poolName": "quarry_saber_aadai", - "relevantAccounts": { - "sunnyPool": "DKsQsX9YjK8Aj9fQs9819HFS8mJXgkkEaLxDy85S4UUS", - "tokenAMint": "EgQ3yNtVhdHz7g1ZhjfGbxhFKMPPaFkz8QHXM5RBZBgi", - "tokenBMint": "JEFFSQ3s8T3wKsvp4tnRAsUBW7Cqgnf8ukBZC4C8XBm1", - "tokenAReserve": "GiehZ4X2uQjhEKuxSm3ACmEFrabxh3RTvjbLfLjw1xGX", - "tokenBReserve": "rxDQYV77NKRKYxCjq4cECX3QQsiSyLv1T1FT2X3zNA2", - "lpTokenSPL": "AVDuGckLavyLr5YifViaxnoveY6rwqDezHw5kiKiRQEC" - }, - "tokenA": "multi-collateral-dai", - "tokenB": "usd-coin", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_aausdc", - "relevantAccounts": { - "sunnyPool": "G3oiA7WtZFeyuj6DZzhoXHJtBHL8cB4xm7XVuMCuHc2W", - "tokenAMint": "8Yv9Jz4z7BUHP68dz8E8m3tMe6NKgpMUKn8KVqrPA6Fr", - "tokenBMint": "JEFFSQ3s8T3wKsvp4tnRAsUBW7Cqgnf8ukBZC4C8XBm1", - "tokenAReserve": "2bPenuBYfqzD8p5dFjCcggwkHDsc2RQDnx9AoyYGUBjA", - "tokenBReserve": "AE6n6iLuX8oYu61vt5hoDYkjswpnxFxrhSehxrnQTnbx", - "lpTokenSPL": "AVC7uVb6R9B34T8zWxQMEK8twvYk26U71gworsujxFNv" - }, - "tokenA": "usd-coin", - "tokenB": "usd-coin", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_aausdt", - "relevantAccounts": { - "sunnyPool": "FYAoBTTQyL3pWhKvX8MjNvdhxSm4k5xAxRSPfi2dp5cQ", - "tokenAMint": "FwEHs3kJEdMa2qZHv7SgzCiFXUQPEycEXksfBkwmS8gj", - "tokenBMint": "AEUT5uFm1D575FVCoQd5Yq891FJEqkncZUbBFoFcAhTV", - "tokenAReserve": "3dFMPj4r9mMmPHF32mz1gNDX7f8ftidWof7S8YiYTs1j", - "tokenBReserve": "Fc1ED3YPeQfXQosHbd8DTaBd2AV5gHQtwiSAL5C5pUhi", - "lpTokenSPL": "AVTrxHq5P57fYZTYjMuCRWFqsrLmom2gGThNtgEgK1ip" - }, - "tokenA": "tether", - "tokenB": "tether", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_aawbtc", - "relevantAccounts": { - "sunnyPool": "4eBrJ9FiQwtnuqrjNSL5jNhNsZjHgW86sVeBEqvSUwsQ", - "tokenAMint": "Fd8xyHHRjTvxfZrBirb6MaxSmrZYw99gRSqFUKdFwFvw", - "tokenBMint": "FACTQhZBfRzC7A76antnpAoZtiwYmUfdAN8wz7e8rxC5", - "tokenAReserve": "bDVSLHopvEo45R3rR7JXoRRAcnUXKD7r14ijj1apALb", - "tokenBReserve": "33QrhvkyroiTxp21hbXPRowPhsgVHmrgEQbY7eHPp1h4", - "lpTokenSPL": "AVBDpg1UYpDYQLbzEnRY76R3u82PYHtDuc3NBdFS2k39" - }, - "tokenA": "wrapped-bitcoin", - "tokenB": "renbtc", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_abbusd", - "relevantAccounts": { - "sunnyPool": "AstN8es9yaN3VYop94Hvvyu4KXBrf9RguBnV15Xcmzna", - "tokenAMint": "6nuaX3ogrr2CaoAPjtaKHAoBNWok32BMcRozuf32s2QF", - "tokenBMint": "JEFFSQ3s8T3wKsvp4tnRAsUBW7Cqgnf8ukBZC4C8XBm1", - "tokenAReserve": "7n9kgNL633yGzCYksgnzHyjG73ZLBAwvEae5sbAekbzW", - "tokenBReserve": "SscdxE99omdG9AiMVwmaEMQySQnCgeAh1sPj2Leutm2", - "lpTokenSPL": "BUSDjE9NEQ15aRFTxKFAjUf5vzqBhEgTNbYevWcSB5qp" - }, - "tokenA": "binance-usd", - "tokenB": "usd-coin", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_acusd", - "relevantAccounts": { - "sunnyPool": "D35qQwbQpVthbPxnab7TX29TxsycKtSAtHkL7YnXE6rg", - "tokenAMint": "EwxNF8g9UfmsJVcZFTpL9Hx5MCkoQFoJi6XNWzKf1j8e", - "tokenBMint": "JEFFSQ3s8T3wKsvp4tnRAsUBW7Cqgnf8ukBZC4C8XBm1", - "tokenAReserve": "44ALBrpqi9PfZkBRTvbtRNtFJGsatfY4QydjtMbFWq8S", - "tokenBReserve": "2ho8qEEie1UjVwWNBo9y4oAJZMyMLx8zPj9bxyUz6uWs", - "lpTokenSPL": "cUSDDDBZRhpDW7eyUUPMuw6u1SiMnzu6i7movwf5jxk" - }, - "tokenA": "celo-dollar", - "tokenB": "usd-coin", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_acusd_cash", - "relevantAccounts": { - "sunnyPool": "8MgufJeVknwE41RRjJB4PFuMACaT9tu7YKeGErXekw5b", - "tokenAMint": "EwxNF8g9UfmsJVcZFTpL9Hx5MCkoQFoJi6XNWzKf1j8e", - "tokenBMint": "C9xqJe3gMTUDKidZsZ6jJ7tL9zSLimDUKVpgUbLZnNbi", - "tokenAReserve": "49EQuSDQNz7L4a22CcnWUxExSpYW4UXSKG985S2drLsR", - "tokenBReserve": "7DH5gc5Hj1Kq4Y9z8ybEmAX1WPoHcunwiav1Za4A5J3J", - "lpTokenSPL": "CLPLCvWFycur9CysMT3pmdkUXxPfBjXVkWyxTGntzoZ7" - }, - "tokenA": "celo-dollar", - "tokenB": "usd-coin", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_acusdc", - "relevantAccounts": { - "sunnyPool": "2vZgBtaVX7Xx77a6ksCLfwKJSsCJt2xcoM5paDYnEcPt", - "tokenAMint": "JEFFSQ3s8T3wKsvp4tnRAsUBW7Cqgnf8ukBZC4C8XBm1", - "tokenBMint": "DHpoYejUDqzByb6HAdaLWF7KZvwUv2vWYDY9cTENNZui", - "tokenAReserve": "AhFPQdu8GKBsxuhiH46UmCu1YpaLgNpoP325HnYtsgas", - "tokenBReserve": "A8wxWpT3aFEr2XqZp1kDmbxbFfcBE95UUmdsNTDBJYbT", - "lpTokenSPL": "GEcowHQW46CrEkfAdbcsdt4SV7taCetZF4sFBXN4USDC" - }, - "tokenA": "usd-coin", - "tokenB": "usd-coin", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_aedai", - "relevantAccounts": { - "sunnyPool": "CVENcGmg3Fhm8BFQ9PGvVMm8N1AMpGaGEwtRt7BBC17X", - "tokenAMint": "9w6LpS7RU1DKftiwH3NgShtXbkMM1ke9iNU4g3MBXSUs", - "tokenBMint": "JEFFSQ3s8T3wKsvp4tnRAsUBW7Cqgnf8ukBZC4C8XBm1", - "tokenAReserve": "B4UtLRZND3D83CitRCBUyeiNr7H8m7YFRqBmiPmXjhW4", - "tokenBReserve": "AAmpYbuixWiSqDaJBCqYEs1pb5SrbdPr9mgXrB58Q2e", - "lpTokenSPL": "aeDebgky5BssqgLo426rXoQTmGrAn1JjEXp6aXFNLic" - }, - "tokenA": "multi-collateral-dai", - "tokenB": "usd-coin", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_aeeth", - "relevantAccounts": { - "sunnyPool": "BD8X5XkHZSeJxctmTMJi2XzivtRqyXhEzXjENXXGhWDK", - "tokenAMint": "KNVfdSJyq1pRQk9AKKv1g5uyGuk6wpm4WG16Bjuwdma", - "tokenBMint": "AaAEw2VCw1XzgvKB8Rj2DyK2ZVau9fbt2bE8hZFWsMyE", - "tokenAReserve": "CGoM82Hbz7QVqTgvQatYtjvDWBvoUJp5qm21P8iMs9yb", - "tokenBReserve": "3dxNNww8TivyN5FMy5dCNdi3Zcxv6e4kUfSPxfFwpdNq", - "lpTokenSPL": "AET3m1Mp2SLi7QX3tSypcZWyEtk1d8dUGcwhweDiZdaR" - }, - "tokenA": "ethereum", - "tokenB": "weth", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_aeusdc", - "relevantAccounts": { - "sunnyPool": "Guc94iBoSxtDJx1XCz3E9go1FqYZwjnHWaG7K9JazJ7U", - "tokenAMint": "DdFPRnccQqLD4zCHrBqdY95D6hvw6PLWp9DEXj1fLCL9", - "tokenBMint": "JEFFSQ3s8T3wKsvp4tnRAsUBW7Cqgnf8ukBZC4C8XBm1", - "tokenAReserve": "3S2jpqSYxho6wiz3cafhjXruVY8cg4HYa2v3BqBHYFSj", - "tokenBReserve": "Dfe67M6TfrG74gKRtdqys4e6E9QirPD53BkF4FujFjuv", - "lpTokenSPL": "AECpyKJWfXVyWnk2d9md5dUj3RuzHRKfQra8MakjuVRz" - }, - "tokenA": "usd-coin", - "tokenB": "usd-coin", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_aeusdt", - "relevantAccounts": { - "sunnyPool": "GWhJ9k9huHmDzg8TqGB8HJy3tu5QNuoEVgdXA6crMNG2", - "tokenAMint": "Bn113WT6rbdgwrm12UJtnmNqGqZjY4it2WoUQuQopFVn", - "tokenBMint": "AEUT5uFm1D575FVCoQd5Yq891FJEqkncZUbBFoFcAhTV", - "tokenAReserve": "Eu1Ze6Z84LWNkq7SNoAHBJbXx5t1P95EwyqYohrfCRFV", - "tokenBReserve": "ASMbv7WNu3qe4pkhREmvyEdwFNDZQ6B6iSrjkj4u8bdC", - "lpTokenSPL": "aeTwxcJhujVCq6rwbJri3s6ViYifsJUCFirMjLHgHZ7" - }, - "tokenA": "tether", - "tokenB": "tether", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_ahusdt", - "relevantAccounts": { - "sunnyPool": "DWCjs3Bfk9HpHSiGCFFo4WCVGmKMCdvc8Texb1L1nqpR", - "tokenAMint": "GfzU1fLASNV3r4NtEyrnwTyTakJkYzoivnaL3Snh45oj", - "tokenBMint": "JEFFSQ3s8T3wKsvp4tnRAsUBW7Cqgnf8ukBZC4C8XBm1", - "tokenAReserve": "DyBGrZkGJHrgbxQXo3sh5KKz7YTzYK9gN8fhRSXN2whK", - "tokenBReserve": "DRr3h3DF9wupahxh6vHMFCm6WGfmJWMrrBHoBvWAweAQ", - "lpTokenSPL": "HLPC9r4gbeP6KagT3qJLzFj7iWcYTJs245k9tuHFQGyR" - }, - "tokenA": "tether", - "tokenB": "usd-coin", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_ahwbtc", - "relevantAccounts": { - "sunnyPool": "6feZZFXicPzoGwdtGiTXeY2dH1Gk79jFwXriqfQDoBR", - "tokenAMint": "Bo4ehCeRcRj2wp5tQpjfCJxYFn4KyRacfDzSa4Aj27tH", - "tokenBMint": "FACTQhZBfRzC7A76antnpAoZtiwYmUfdAN8wz7e8rxC5", - "tokenAReserve": "56TsbS21JcCVgD8x7HDivK371QPWhNWPvH5QPA6oqmTX", - "tokenBReserve": "LRiFt5Sa2dCx2njaRMTVtkxKbiH2EJV2KN1b7FjMube", - "lpTokenSPL": "HLPPmd7NzTTNiqKR6rAZYgrH9VhU47kxftecQSk2oD6J" - }, - "tokenA": "wrapped-bitcoin", - "tokenB": "renbtc", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_apusdc", - "relevantAccounts": { - "sunnyPool": "93VzPkdzFEyHKXqVw1mZ6pdtjbdM4eYuYqyc5p8HmfSw", - "tokenAMint": "eqKJTf1Do4MDPyKisMYqVaUFpkEFAs3riGF3ceDH2Ca", - "tokenBMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", - "tokenAReserve": "4xkyD7AfGQDwsQMy9MosRRNGoVJ1zosNinesxg1TzHG7", - "tokenBReserve": "Cbm5gsQe3nSiCsFrvepVzMCD9xLK3ri9g3ypS2hdmVJ7", - "lpTokenSPL": "APUVVYA8Xf7T1PqLyDvNxLtwQ9rRDf3RUxfMttreVzHP" - }, - "tokenA": "usd-coin", - "tokenB": "usd-coin", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_apusdt", - "relevantAccounts": { - "sunnyPool": "8WoMYJVtnbxenvZSbvbqwjcwdiM21SZVifJPjVyzRjsp", - "tokenAMint": "DNhZkUaxHXYvpxZ7LNnHtss8sQgdAfd1ZYS1fB7LKWUZ", - "tokenBMint": "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB", - "tokenAReserve": "D6d156U1bPiJpDYRLextvDRccgFk7QzkQbJg42ceKEu5", - "tokenBReserve": "GNcM8U5g8RwTZffwwm3kSQqUNPSwv5d2fbN9sLxPJqt2", - "lpTokenSPL": "PLYJZgSkcV8UXTWhTyf2WLCMeBoZum1Y4rXgXkoYiNj" - }, - "tokenA": "tether", - "tokenB": "tether", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_asol", - "relevantAccounts": { - "sunnyPool": "HCiHNn5HxeBssdijUAh2AB8co249FH8WWKVK6k4VF1tq", - "tokenAMint": "ASoLXbfe7cd6igh5yiEsU8M7FW64QRxPKkxk7sjAfond", - "tokenBMint": "So11111111111111111111111111111111111111112", - "tokenAReserve": "BKWm4TRnTeKwfWXRyuzjRHU7iZDkPuXBX5b5V5jSVfGJ", - "tokenBReserve": "A5Ww74HVrkj9nPeC7pHKLfgeDMEhBCpW1efQdz3TGLEg", - "lpTokenSPL": "ALP89a89ASo1h5VosTSABtQBKLBgeoaWQexYQrRCMNfV" - }, - "tokenA": "solana", - "tokenB": "solana", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_btc", - "relevantAccounts": { - "sunnyPool": "4P2sGCjQtArNbmVHNxiXsTKCejkTfMKby7PfTs92fuV4", - "tokenAMint": "CDJWUqTcYTVAKXAVXoQZFes5JUFc7owSeq7eMQcDSbo5", - "tokenBMint": "SBTCB6pWqeDo6zGi9WVRMLCsKsN6JiR1RMUqvLtgSRv", - "tokenAReserve": "35yX27bmurdebhfAb8EPmjLETDiUaEUCn9zHaDPbakH2", - "tokenBReserve": "2CxECn1ZJFoESyUnQysQU8rRgT3iJ5GRs2Mdd6gZjx5g", - "lpTokenSPL": "SLPbsNrLHv8xG4cTc4R5Ci8kB9wUPs6yn6f7cKosoxs" - }, - "tokenA": "renbtc", - "tokenB": "bitcoin", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_busd", - "relevantAccounts": { - "sunnyPool": "9wb3VoNdi8e4X1xfHwYDmtoD84yUkc5z7gfaXCm92Nx4", - "tokenAMint": "AJ1W9A9N9dEMdVyoDiam2rV44gnBm2csrPDP7xqcapgX", - "tokenBMint": "JEFFSQ3s8T3wKsvp4tnRAsUBW7Cqgnf8ukBZC4C8XBm1", - "tokenAReserve": "5uerVwBnZQsuVhZ15igs7ZgmcqhHnYWbwoRtLyRqLvR", - "tokenBReserve": "9YWiQh5d4jCtgMdzcGLv9bWgnLaFtzvDDh2nnhJdzhBX", - "lpTokenSPL": "BUSDaZjarCrQJLeHpWi7aLaKptdR1S8DFpwdDuuZu9p3" - }, - "tokenA": "binance-usd", - "tokenB": "usd-coin", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_cash", - "relevantAccounts": { - "sunnyPool": "EBSEehvHWmeujhgXbXoSvgVSJZSe3kaw7qR8RTaEhr1P", - "tokenAMint": "CASHVDm2wsJXfhj6VWxb7GiMdoLc17Du7paH4bNr5woT", - "tokenBMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", - "tokenAReserve": "7EifTDGz2nEU7DiE2UuuBX9Efkbdfad47mgr7Bqrqo8Y", - "tokenBReserve": "FoL4JKwgaRUnf5c8wZDYdSam98NepnZ6oJDNFqPLuRvr", - "lpTokenSPL": "CLPKiHjoU5HwpPK5L6MBXHKqFsuzPr47dM1w4An3Lnvv" - }, - "tokenA": "usd-coin", - "tokenB": "usd-coin", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_dai", - "relevantAccounts": { - "sunnyPool": "ES6mXVjcebPz3QuZNWa7dgj7TVv8Tjtwdj4McWwJUF2M", - "tokenAMint": "FYpdBuyAHSbdaAyD1sKkxyLWbAP8uUW9h6uvdhK74ij1", - "tokenBMint": "JEFFSQ3s8T3wKsvp4tnRAsUBW7Cqgnf8ukBZC4C8XBm1", - "tokenAReserve": "A7VkMFrnCCyeZFUrQ3TzDr4xFep7PZtxvy3jJnBjLB2a", - "tokenBReserve": "PhfHJ2Yu99BsEjZrefhApqUnLUiExcECcUT1YLoNUUv", - "lpTokenSPL": "Daimhb91DY4e3aVaa7YCW5GgwaMT9j1ALSi2GriBvDNh" - }, - "tokenA": "dai", - "tokenB": "usd-coin", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_frax", - "relevantAccounts": { - "sunnyPool": "6qqtRvbrYuS2P56AjkBConWsJrS7DvtQAjA4AF6gNShf", - "tokenAMint": "8L8pDf3jutdpdr4m3np68CL9ZroLActrqwxi6s9Ah5xU", - "tokenBMint": "JEFFSQ3s8T3wKsvp4tnRAsUBW7Cqgnf8ukBZC4C8XBm1", - "tokenAReserve": "7eEYpq6ShaJ9opZWMxitRFrdCHh6vfyHhGfoSvFht3N2", - "tokenBReserve": "H8VggnHmuwd1wvwpT8eg9cUJFEfZ7HAaeYjgXrSm7A2u", - "lpTokenSPL": "FRAXXvt2ucEsxYPK4nufDy5zKhb2xysieqRBE1dQTqnK" - }, - "tokenA": "frax", - "tokenB": "usd-coin", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_ftt", - "relevantAccounts": { - "sunnyPool": "GRrf2DDzDqynoXh9rpTeXYbqMaFtHrQJsgBYzqnsDcvx", - "tokenAMint": "GbBWwtYTMPis4VHb8MrBbdibPhn28TSrLB53KvUmb7Gi", - "tokenBMint": "FTT9rBBrYwcHam4qLvkzzzhrsihYMbZ3k6wJbdoahxAt", - "tokenAReserve": "46xwHtnXoQR3wCHUbm2eCAbPYWbioDQ59Te1Db8M5DDL", - "tokenBReserve": "FC38fiikZwFvDt5zTjNtGfKd7LjaPz2uUAzLwKP5pRJY", - "lpTokenSPL": "FTXdV5wFFhceKjcd1JRrRQTT2uB7ruMerAqbj2rj1Mz7" - }, - "tokenA": "ftx-token", - "tokenB": "ftx-token", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_hbtc", - "relevantAccounts": { - "sunnyPool": "778pp6bURm31CZXtHWZt4s7zDuTiU9S64X53HizXtV68", - "tokenAMint": "8pBc4v9GAwCBNWPB5XKA93APexMGAS4qMr37vNke9Ref", - "tokenBMint": "FACTQhZBfRzC7A76antnpAoZtiwYmUfdAN8wz7e8rxC5", - "tokenAReserve": "GsizhiRtCs4QDKd2LnSQ9BpzvG8CqERMDtHZcQPDkFQB", - "tokenBReserve": "CRaJHfCry6JShmF4tMr6siR2D2QNNfcUrLawTqPVCTTJ", - "lpTokenSPL": "HBTCNvkwjMsEtwe2PeXUuMcu8C4Hobw6HDP2m6vpWHGo" - }, - "tokenA": "huobi-btc", - "tokenB": "renbtc", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_husd", - "relevantAccounts": { - "sunnyPool": "7PVN9aNkcREn53M7GYC92hxmzxhNYMscFtjr2R9R1q3A", - "tokenAMint": "BybpSTBoZHsmKnfxYG47GDhVPKrnEKX31CScShbrzUhX", - "tokenBMint": "88881Hu2jGMfCs9tMu5Rr7Ah7WBNBuXqde4nR5ZmKYYy", - "tokenAReserve": "2mUxDu8NrhSKhQJMgKfYLxJqZzeEbmwhQdHeHMyohyuk", - "tokenBReserve": "AZCBmDBcFsA2jHHhfFJBTsWCHx9XnnKmGfFsue3ZVW1t", - "lpTokenSPL": "HUSDgP5YieANhAAHD42yivX9aFS1zbodTut2Dvvkj8QS" - }, - "tokenA": "husd", - "tokenB": "usd-coin", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_ibbtc", - "relevantAccounts": { - "sunnyPool": "8XWAa763NEkwDtkSAs4Se1JhuUDb8qfaKotwoLcKdK8w", - "tokenAMint": "66CgfJQoZkpkrEgC1z4vFJcSFc4V6T5HqbjSSNuqcNJz", - "tokenBMint": "9999j2A8sXUtHtDoQdk528oVzhaKBsXyRGZ67FKGoi7H", - "tokenAReserve": "Fb2Zdo7hWjMmwMXn7589WbPbjVPxVUQgPgs5cAcStJm8", - "tokenBReserve": "AjVXZPzFEShWkGASQv5dBp9r4Xf6V1mvyHWfH5UWF9c3", - "lpTokenSPL": "BADGsQo6rTxKZuqkY1kSoqhriQwZW3ZVgyPjgDk9mvyo" - }, - "tokenA": "bitcoin", - "tokenB": "bitcoin", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_ibbtc_ren", - "relevantAccounts": { - "sunnyPool": "FhEGpVfYQUBXWWsSnfXYrmCFBqgghPfrmcRC39eEkvyd", - "tokenAMint": "66CgfJQoZkpkrEgC1z4vFJcSFc4V6T5HqbjSSNuqcNJz", - "tokenBMint": "FACTQhZBfRzC7A76antnpAoZtiwYmUfdAN8wz7e8rxC5", - "tokenAReserve": "CZ48nQQ6GK8Z7hGBPdxTtMzRBA8werj5iciVJnc3vz1S", - "tokenBReserve": "G3nLYyvP46npva5MEobZVJhcDNzJ4rrHgLGJMtvyad5c", - "lpTokenSPL": "BRENm9SgYJZuCxM4ZJiH6CmZqEBn4MLpD9cnBZDnJgeT" - }, - "tokenA": "bitcoin", - "tokenB": "renbtc", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_luna", - "relevantAccounts": { - "sunnyPool": "AoEShMnruaF3CHocY8cF775nzxr1iyYbToXMvymcEy67", - "tokenAMint": "2Xf2yAXJfg82sWwdLUo2x9mZXy6JCdszdMZkcF1Hf4KV", - "tokenBMint": "KUANeD8EQvwpT1W7QZDtDqctLEh2FfSTy5pThE9CogT", - "tokenAReserve": "Au5zcSost9sXpH8AQQjULRXJ9QCJ3kdKehUr1zYzTr6G", - "tokenBReserve": "Gx1L7n1YhDWLNfUyCeZfzKvwHJSxhppnk4DS5cZLqyd", - "lpTokenSPL": "LUNkiLcb2wxcqULmJvMjuM6YQhpFBadG5KZBe7qBpSE" - }, - "tokenA": "wrapped-terra", - "tokenB": "terra-luna", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_mai", - "relevantAccounts": { - "sunnyPool": "RrFrHdkHExmUGkd9BJd4j4SgpX1T1LdKTmuPyPHcthz", - "tokenAMint": "9mWRABuz2x6koTPCWiCPM49WUbcrNqGTHBV9T9k7y1o7", - "tokenBMint": "JEFFSQ3s8T3wKsvp4tnRAsUBW7Cqgnf8ukBZC4C8XBm1", - "tokenAReserve": "DhgiEgiNdqZdRdo195UUHnoEJUtefK8buko8nU97XJUZ", - "tokenBReserve": "2K2kkXsouBHtWVjtcgkyiXd8eP3oVBvq1bTJzcVdLLr2", - "lpTokenSPL": "MAiP3Zmjhc6NYiCb2xK2893ifvTTDHciCS57Kga39pC" - }, - "tokenA": "mimatic", - "tokenB": "usd-coin", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_msol_sol", - "relevantAccounts": { - "sunnyPool": "ABTVKgFr6NcayrKhKuEUNfTcFcm7MhXMBJDfZDE9p3Y4", - "tokenAMint": "mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So", - "tokenBMint": "So11111111111111111111111111111111111111112", - "tokenAReserve": "9DgFSWkPDGijNKcLGbr3p5xoJbHsPgXUTr6QvGBJ5vGN", - "tokenBReserve": "2hNHZg7XBhuhHVZ3JDEi4buq2fPQwuWBdQ9xkH7t1GQX", - "lpTokenSPL": "SoLEao8wTzSfqhuou8rcYsVoLjthVmiXuEjzdNPMnCz" - }, - "tokenA": "msol", - "tokenB": "solana", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_pai_cash", - "relevantAccounts": { - "sunnyPool": "2cg1g8VhnMobXNAVBCXyL5FVLhbEXp8XVAbmT1ZMJJox", - "tokenAMint": "Ea5SjE2Y6yvCeW5dYTn7PYMuW5ikXkvbGdcmSnXeaLjS", - "tokenBMint": "CASHVDm2wsJXfhj6VWxb7GiMdoLc17Du7paH4bNr5woT", - "tokenAReserve": "F36eiDG64zYoAA9vtTvV4EWcTqYNUku7hzhUyTYcQSin", - "tokenBReserve": "FXJq5PZ8XshMvhcfX2y3khJyWK6S5W7ftLeMgbuFgwDG", - "lpTokenSPL": "CLP2aB2bCXZEaoQjUNQdn64dCSzCVxKE3Kjgo3PcAYeY" - }, - "tokenA": "parrot-usd", - "tokenB": "usd-coin", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_pbtc", - "relevantAccounts": { - "sunnyPool": "7nr2uHNJMMUNnx7W5PaYjzv8MC44Rqp5Ju51djrUvSyz", - "tokenAMint": "CDJWUqTcYTVAKXAVXoQZFes5JUFc7owSeq7eMQcDSbo5", - "tokenBMint": "DYDWu4hE4MN3aH897xQ3sRTs5EAjJDmQsKLNhbpUiKun", - "tokenAReserve": "DvHVapj4g2Y1tJVSw2ubSPkPBsJPb8fW387ZWXwaKmZq", - "tokenBReserve": "DKjqWWgrtDRPKrnMWtZ4UiJk4sGQVCQgFjSo7BvfngvK", - "lpTokenSPL": "pBTCmyG7FaZx4uk3Q2pT5jHKWmWDn84npdc7gZXpQ1x" - }, - "tokenA": "renbtc", - "tokenB": "ptokens-btc", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_port_2pool", - "relevantAccounts": { - "sunnyPool": "3sGzHd66PGuC2Y1uJUtem6AXn4nwfEAy1YSUF9BGkSCW", - "tokenAMint": "3RudPTAkfcq9Q9Jk8SVeCoecCBmdKMj6q5smsWzxqtqZ", - "tokenBMint": "FgSsGV8GByPaMERxeQJPvZRZHf7zCBhrdYtztKorJS58", - "tokenAReserve": "2tBpLvzYBCs7e4DrRocEnssoJANB8rDh2jt5FbeCAeK1", - "tokenBReserve": "DLkWGoaeXw4oeGPnr2ecJze541HVKFhrhaW4iVSFEwET", - "lpTokenSPL": "PortuzxBGYMQXeNmM9Kc6AtHLBwqSrb6xWwZ4trQ1en" - }, - "tokenA": "tether", - "tokenB": "usd-coin", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_prtsol", - "relevantAccounts": { - "sunnyPool": "ADwAz4Re8zDo7P1uhVF7VQHRRLZrotWz8Wyf13atLV6d", - "tokenAMint": "BdZPG9xWrG3uFrx2KrUW1jT4tZ9VKPDWknYihzoPRJS3", - "tokenBMint": "So11111111111111111111111111111111111111112", - "tokenAReserve": "9ZDpBKPqMABtGfq66FbVribaArMvtk63xxy91onZAtDt", - "tokenBReserve": "DaTP4s6N7xxSPinbNZ3FB52EpRDRt87QShTuN3VPCW52", - "lpTokenSPL": "PrsVdKtXDDf6kJQu5Ff6YqmjfE4TZXtBgHM4bjuvRnR" - }, - "tokenA": "solana", - "tokenB": "solana", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_psol", - "relevantAccounts": { - "sunnyPool": "D7FXWcnRGRrxypYZvujosegypQ9MsZ6cZMoh8qAJVmqN", - "tokenAMint": "9EaLkQrbjmbbuZG9Wdpo8qfNUEjHATJFSycEmw6f1rGX", - "tokenBMint": "BdZPG9xWrG3uFrx2KrUW1jT4tZ9VKPDWknYihzoPRJS3", - "tokenAReserve": "3oyc6hpjYSJEquK6dSvG72NXyz3pqLZz5D8AC71pwgQb", - "tokenBReserve": "Di2vordgFJVZ1aj1aBpvzXtLfZgJsuLLXawGtVFwX6Rz", - "lpTokenSPL": "PSopTFPXzTRysj2H6W8oTvYBZmJHtRcVaQaDkckifAy" - }, - "tokenA": "solana", - "tokenB": "solana", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_socean", - "relevantAccounts": { - "sunnyPool": "EfpaH6fykCjgpH6wr72uvVbxJGziu5otyyY3gUN76Si2", - "tokenAMint": "5oVNBeEEQvYi1cX3ir8Dx5n1P7pdxydbGF2X4TxVusJm", - "tokenBMint": "So11111111111111111111111111111111111111112", - "tokenAReserve": "DjvZuMZ46fxKBoBpGMPcRcos4xdTtHFxwMh69DpA2ZFY", - "tokenBReserve": "9rvDPJLAng4uVVqnnSoEXgNDFhBZQTny9AoQioYDZbQX", - "lpTokenSPL": "SoCJs5Qw1D3fjGbTqxxovK15FVnYVrwvTbYcBBrZmWj" - }, - "tokenA": "socean-staked-sol", - "tokenB": "solana", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_srm", - "relevantAccounts": { - "sunnyPool": "9rVWaDfo3htoJVeSwb9Yva8gZif3hY9kwWzAiptW4JNY", - "tokenAMint": "2jXy799YnEcRXneFo2GEAB6SDRsAa767HpWmktRr1DaP", - "tokenBMint": "SRMuApVNdxXokk5GT7XD5cUUgXMBCoAz2LHeuAoKWRt", - "tokenAReserve": "C5uYkVHiFduEFq8S3fr4pgUS24oYj1sjZ8WW2cb4j8SU", - "tokenBReserve": "3F5DPU5ScgHiFzePYUHZovvgh3uqmM5keNvbavx2ERqV", - "lpTokenSPL": "SRMKjSJpBHJ5gSVTrimci49SnXc1LVkBi9TGF9RNYdp" - }, - "tokenA": "serum", - "tokenB": "serum", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_stsol", - "relevantAccounts": { - "sunnyPool": "5wT6PTeVdsBH9DGiWhCWVdrHDaFCSdDQgttvgxDhzcA4", - "tokenAMint": "7dHbWXmci3dT8UFYWYZweBLXgycu7Y3iL6trKn1Y7ARj", - "tokenBMint": "So11111111111111111111111111111111111111112", - "tokenAReserve": "4PgzyzLtds9bKZ2to9PMnKqJzKEUpjvNUaeN23phegax", - "tokenBReserve": "AtymwxoVN9peZo7EXTcDz9jKVc4vRmisJKKrNfe3ewBa", - "lpTokenSPL": "stSjCmjQ96BiGhTk8gkU22j1739R8YBQVMq7KXWTqUV" - }, - "tokenA": "solana", - "tokenB": "solana", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_usdc_pai", - "relevantAccounts": { - "sunnyPool": "3fnwDWqNTg9cK861gfwT3fU9HmgigWWCaNq3jhiYhRpG", - "tokenAMint": "Ea5SjE2Y6yvCeW5dYTn7PYMuW5ikXkvbGdcmSnXeaLjS", - "tokenBMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", - "tokenAReserve": "4DYwgJtxwuJdAjkj5RJSNH4e7U329V5cNp7d3a1nLrZv", - "tokenBReserve": "EXNW64GEf1ACC6xY9BtKRiunrs6GoJSXBdxWN2eTPmrF", - "lpTokenSPL": "PaiYwHYxr4SsEWox9YmyBNJmxVG7GdauirbBcYGB7cJ" - }, - "tokenA": "parrot-usd", - "tokenB": "usd-coin", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_usdc_usdt", - "relevantAccounts": { - "sunnyPool": "3Zk1PhVap6mwrB9jZktucoSaMBa2whYSq8jtLew3tXbp", - "tokenAMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", - "tokenBMint": "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB", - "tokenAReserve": "CfWX7o2TswwbxusJ4hCaPobu2jLCb1hfXuXJQjVq3jQF", - "tokenBReserve": "EnTrdMMpdhugeH6Ban6gYZWXughWxKtVGfCwFn78ZmY3", - "lpTokenSPL": "2poo1w1DL6yd2WNTCnNTzDqkC6MBXq7axo77P16yrBuf" - }, - "tokenA": "usd-coin", - "tokenB": "tether", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_usdk", - "relevantAccounts": { - "sunnyPool": "FtDqjkFWgxLsUH4sAX8EAwQKmTrsMUdddPEwAZu1j1SY", - "tokenAMint": "2kycGCD8tJbrjJJqWN2Qz5ysN9iB4Bth3Uic4mSB7uak", - "tokenBMint": "JEFFSQ3s8T3wKsvp4tnRAsUBW7Cqgnf8ukBZC4C8XBm1", - "tokenAReserve": "5RfXYWvxR9PUaedokXVxgJHDoD4xnLLauVtdJ27shPWG", - "tokenBReserve": "DJcFPaQjyW9Xkt7sXCbnEGj1yfykGYuLRUXFyS4LLZ5F", - "lpTokenSPL": "uSdKg2Cs5bCtFSeNXs7aRVNzZJauX58eCkdsfssxTdW" - }, - "tokenA": "usdk", - "tokenB": "usd-coin", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_ust", - "relevantAccounts": { - "sunnyPool": "J6kYSfcvWUBVE2J7c4T9jvsj8Joimxt9KapAyQkkGwp5", - "tokenAMint": "JEFFSQ3s8T3wKsvp4tnRAsUBW7Cqgnf8ukBZC4C8XBm1", - "tokenBMint": "CXLBjMMcwkc17GfJtBos6rQCo1ypeH6eDbB82Kby4MRm", - "tokenAReserve": "D9yh4KAysxt9GLacVe4Wwh2XqghhcjTCSTV9HuM7TBJd", - "tokenBReserve": "HDYfJLpZKaMFb84jM4mRytn7XLR8UFZUnQpSfhJJaNEy", - "lpTokenSPL": "UST32f2JtPGocLzsL41B3VBBoJzTm1mK1j3rwyM3Wgc" - }, - "tokenA": "usd-coin", - "tokenB": "terrausd", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_ust_cash", - "relevantAccounts": { - "sunnyPool": "2cjiAfw4ApUjaGm4HtzwdVzNYGeBgS5VvpqnvYcafesU", - "tokenAMint": "9vMJfxuKxXBoEa7rM12mYLMwTacLMLDJqHozw96WQL8i", - "tokenBMint": "CASHVDm2wsJXfhj6VWxb7GiMdoLc17Du7paH4bNr5woT", - "tokenAReserve": "JAjt8kZkTsxKA3VKnmszKHQwzuNSAXXhN3Y4NZ2kEoLU", - "tokenBReserve": "F2NtJ1kcLLvQZ6RMH5sApf12BpGpAeGwio3WWPRZWUDu", - "lpTokenSPL": "CLPRkuzQFiYnXddGTTKLvqgjgh4Tm7q16sVvivWNRzo8" - }, - "tokenA": "terrausd", - "tokenB": "usd-coin", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_wdai", - "relevantAccounts": { - "sunnyPool": "75dRdYpYSYDnLrhnxu1ofSWyM9D6C5bjJNR5Dx6v1d7E", - "tokenAMint": "EjmyN6qEC1Tf1JxiG1ae7UTJhUxSwk1TCWNWqxWV4J6o", - "tokenBMint": "88881Hu2jGMfCs9tMu5Rr7Ah7WBNBuXqde4nR5ZmKYYy", - "tokenAReserve": "725ZA3fhyBAKb5iopNRrcbSuQa3LXA1656Q3mBvYPxeg", - "tokenBReserve": "GLA6i1dSZpUfk2f9Nj8uiG7xyDdAR2reff8oEiZH3617", - "lpTokenSPL": "DAihWEjhBc8LEmV1rEekTaiC2zqE5ex7nEFkmoe1Ppp3" - }, - "tokenA": "dai", - "tokenB": "usd-coin", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_webusd", - "relevantAccounts": { - "sunnyPool": "4YyWv4fh49Pdh2PRftH6cS8w7pWipoS5Joaf4HSDD8wB", - "tokenAMint": "33fsBLA8djQm82RpHmE3SuVrPGtZBWNYExsEUeKX1HXX", - "tokenBMint": "88881Hu2jGMfCs9tMu5Rr7Ah7WBNBuXqde4nR5ZmKYYy", - "tokenAReserve": "4ZjU6MKvtqVQKCiowhvZ5yUsPxXX5SCzd5eFsPeXyey5", - "tokenBReserve": "BsyWeshjDbCvjDojry3vKDCesmFRM37WtwcR4Kfgzqr", - "lpTokenSPL": "BSCNZ4GLnpZYv4BLk5edymk4qty8a6ZpiMbfvtv9gAzL" - }, - "tokenA": "binance-usd", - "tokenB": "usd-coin", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_weusdc", - "relevantAccounts": { - "sunnyPool": "GxbxYFigYTQg5thJwroii78kYWqNFseGeE1Cx3rtAs6t", - "tokenAMint": "A9mUU4qviSctJVPJdBJWkb28deg915LYJKrzQ19ji3FM", - "tokenBMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", - "tokenAReserve": "3YB7hfpBdbQEuZqLGWVDpRPmeZWCUsrrWyqGXegnQ6Cg", - "tokenBReserve": "4DPCj6Z1DsG6HUtwSogBGqXEUxdEV5a8YVrrFtcnz7UW", - "lpTokenSPL": "USDCgfM1psLGhAbx99iPA72mTySvUcVq33qhCJpm65c" - }, - "tokenA": "usd-coin", - "tokenB": "usd-coin", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_weusdt", - "relevantAccounts": { - "sunnyPool": "9KYAPsNV354dfyhNiuw3qKvCNwAwUTcL5M6b7pT8c1xU", - "tokenAMint": "Dn4noZ5jgGfkntzcQSUZ8czkreiZ1ForXYoV2H8Dm7S1", - "tokenBMint": "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB", - "tokenAReserve": "DtfyjjsZ5yCjWKLKHvwsfXs5QVsmm1QkK6Sh9JZHoq1g", - "tokenBReserve": "e5wrKCRv4GhHvEf1VD5Pq2KGaZDXP77nTL612Jyrxwy", - "lpTokenSPL": "USDTJZL2vH92K5QeCvQTTzvMXUYAdvk3v46CwZyfsue" - }, - "tokenA": "tether", - "tokenB": "tether", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_wfrax", - "relevantAccounts": { - "sunnyPool": "7aLF3aQcwZv6QNuFLioyXTje3hYuzed2KvgQjQUBYLi8", - "tokenAMint": "FR87nWEUxVgerFGhZM8Y4AggKGLnaXswr1Pd8wZ4kZcp", - "tokenBMint": "88881Hu2jGMfCs9tMu5Rr7Ah7WBNBuXqde4nR5ZmKYYy", - "tokenAReserve": "DD4ACBWyVqdaKWh7v5btsgqQCCMwbKnuL2xd9pv7Gyuw", - "tokenBReserve": "GcYqiJ1MAuYbNTNYXm1F1gQYTfTgkErACAhNU5dpVj9T", - "lpTokenSPL": "FRXsjEv4jF3r72FgbCXu8uLbPoZGLmCmg3EN1S3cfC4x" - }, - "tokenA": "frax", - "tokenB": "usd-coin", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_wftt", - "relevantAccounts": { - "sunnyPool": "6WSukUGc9EvRYHniPEz3KRAvc24wnZ1Q92DogQLSS4b", - "tokenAMint": "BFsCwfk8VsEbSfLkkgmoKsAPk2N6FMJjeTsuxfGa9VEf", - "tokenBMint": "FTT9GrHBVHvDeUTgLU8FxVJouGqg9uiWGmmjETdm32Sx", - "tokenAReserve": "CyFL8noR6CKMFBjZPziSmChCKJE1Jtg4hQyMhgWPgH84", - "tokenBReserve": "5PfKQpBWUayFWSSkwjp1PLr8LiHBrvVB81qfnSP5Dvkb", - "lpTokenSPL": "FTXjwjwWqituSXEHnL5VF1mjDhZoAyJqvHiRPsRq3KWK" - }, - "tokenA": "ftx-token", - "tokenB": "ftx-token", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_wheth", - "relevantAccounts": { - "sunnyPool": "5BJpF1gtS1WpG1g4PHuAAFngP7Cmk6pzabBZbH4AKaSK", - "tokenAMint": "SL819j8K9FuFPL84UepVcFkEZqDUUvVzwDmJjCHySYj", - "tokenBMint": "7vfCXTUXx5WJV5JADk17DUJ4ksgau7utNKj4b963voxs", - "tokenAReserve": "8p4mGnARWPBu6P2Gcw4adodLkNDorrXniZMhaY7eJXUn", - "tokenBReserve": "AyY89zccbsgp9LKFgH4CFZMJmpSgqmPSdTfukhP227rc", - "lpTokenSPL": "WTHPuMavN9HBvgUafjrL65WqQytQHDwnTAmdFB9whXA" - }, - "tokenA": "ethereum", - "tokenB": "ethereum", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_whusd", - "relevantAccounts": { - "sunnyPool": "74v27c1cFB49uTvktums6HAb6px4ryv8Yc7DcppneJEL", - "tokenAMint": "7VQo3HFLNH5QqGtM8eC3XQbPkJUu7nS9LeGWjerRh5Sw", - "tokenBMint": "88881Hu2jGMfCs9tMu5Rr7Ah7WBNBuXqde4nR5ZmKYYy", - "tokenAReserve": "E7L8CZxreEeNwM1V8DLxa8AZQKu6oday6RvXxRo27CHi", - "tokenBReserve": "48UJw19Ra8y5Kv989DsXPrfUHeUWUbHvXZmdPBbGuHdz", - "lpTokenSPL": "HUSzWddUQbavKn24cjozm65eps8rq9yhNn5edtTLWfdz" - }, - "tokenA": "husd", - "tokenB": "usd-coin", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_wluna", - "relevantAccounts": { - "sunnyPool": "FfUiwneyuHdrcSFMEUFXdp7VirpPXveANgZP4NWyk1Kp", - "tokenAMint": "F6v4wfAdJB8D8p77bMXZgYt8TDKsYxLYxH5AFhUkYx9W", - "tokenBMint": "8wv2KAykQstNAj2oW6AHANGBiFKVFhvMiyyzzjhkmGvE", - "tokenAReserve": "GgRnQyCm22UkHQME96CqJFpsqV93QJQsWMURdsQSSAdk", - "tokenBReserve": "GrWSq33By3uf7Vqqfrscy7oJMuqGgZojd2KSzsxioxQL", - "lpTokenSPL": "LUN1p1dZwSBgTv1JSdn2apdUuLanHKtgNcnpDydVFTU" - }, - "tokenA": "terra-luna", - "tokenB": "terra-luna", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_wpusdc", - "relevantAccounts": { - "sunnyPool": "8LsKf2vzMyKPbMbN2SgxTUdzA4ijSEprDUoQoEyELGkW", - "tokenAMint": "E2VmbootbVCBkMNNxKQgCLMS1X3NoGMaYAsufaAsf7M", - "tokenBMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", - "tokenAReserve": "y8dALFo1bJrSzPYjMX14HJX448pXqYmrfXHD1K8MXih", - "tokenBReserve": "GN7Yuet3UyiWS5YVkEHv6oQKi4HGBJc3XDPt9zQhAqZz", - "lpTokenSPL": "WLPyXq7WRfdWLiP4fvRfSisrfDzLiPmCeVTE6okKQWE" - }, - "tokenA": "usd-coin", - "tokenB": "usd-coin", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_wpusdt", - "relevantAccounts": { - "sunnyPool": "2A4Xr9Gezyytrr8Q97HvahTV5bX3m9DJFirL7uJBh7ss", - "tokenAMint": "5goWRao6a3yNC4d6UjMdQxonkCMvKBwdpubU3qhfcdf1", - "tokenBMint": "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB", - "tokenAReserve": "631WX9JizSHJm4w6VanZeJAst9T8DeUUnPLesdGkCVtK", - "tokenBReserve": "211maUSfpnXbPuW1iBu8b4dtJv5EbN1j7JJiEX5TZKEP", - "lpTokenSPL": "WLP59xUDvQMQdzC2SgPmZeRF1oj2RSvGZiQLksj4bwj" - }, - "tokenA": "tether", - "tokenB": "tether", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_wusdk", - "relevantAccounts": { - "sunnyPool": "B7pvYmmMFk2X4vUi1n2BBkxYj9dY5tq5XJoErwFv6jES", - "tokenAMint": "43m2ewFV5nDepieFjT9EmAQnc1HRtAF247RBpLGFem5F", - "tokenBMint": "88881Hu2jGMfCs9tMu5Rr7Ah7WBNBuXqde4nR5ZmKYYy", - "tokenAReserve": "CMR2J7CwfW98RpvnJmFBgRFTLAd3x8CJ1SWs8Bt3uunG", - "tokenBReserve": "FmRb5jHfSNj1YWP3b45d9vvYuhwjp4om8bALmtqZpr1v", - "lpTokenSPL": "USDKKmk1anWU1aEn6GJ6skL3ZvcB9CBAWVkmPGQEHtz" - }, - "tokenA": "usdk", - "tokenB": "usd-coin", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_wust", - "relevantAccounts": { - "sunnyPool": "AAoP2zqcuQ4hesQsCsAqFKDfKJuH8rwXhFrWhB8i52bU", - "tokenAMint": "9vMJfxuKxXBoEa7rM12mYLMwTacLMLDJqHozw96WQL8i", - "tokenBMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", - "tokenAReserve": "J63v6qEZmQpDqCD8bd4PXu2Pq5ZbyXrFcSa3Xt1HdAPQ", - "tokenBReserve": "BnKQtTdLw9qPCDgZkWX3sURkBAoKCUYL1yahh6Mw7mRK", - "lpTokenSPL": "USTCmQpbUGj5iTsXdnTYHZupY1QpftDZhLokSVk6UWi" - }, - "tokenA": "terrausd", - "tokenB": "usd-coin", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_xbtc", - "relevantAccounts": { - "sunnyPool": "DdmQPMjBanrAZLc4fgYPeRmEZkU8LPH4tB7Qktfegd79", - "tokenAMint": "HWxpSV3QAGzLQzGAtvhSYAEr7sTQugQygnni1gnUGh1D", - "tokenBMint": "BtX7AfzEJLnU8KQR1AgHrhGH5s2AHUTbfjhUQP8BhPvi", - "tokenAReserve": "C82XDu1d1UjtuUwnkSTwVuWyH3AqpJ3ftb9W7en8rEUu", - "tokenBReserve": "F7cZoYpWQSFuYJzW2UUFw6sVbTtaihyD5upeeHRUPABk", - "lpTokenSPL": "xBTCPvRuEuRgz5DuuUd3ju3VP5XtR2Dsu1AxyW9JpXK" - }, - "tokenA": "bitcoin", - "tokenB": "renbtc", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_xeth", - "relevantAccounts": { - "sunnyPool": "BYaEPQ4aWSMkBtuzYycowy4c7C9jCnzALcZtD1fsRsj4", - "tokenAMint": "8bqjz8DeSuim1sEAsQatjJN4zseyxSPdhHQcuuhL8PCK", - "tokenBMint": "KNVfdSJyq1pRQk9AKKv1g5uyGuk6wpm4WG16Bjuwdma", - "tokenAReserve": "3gkSjY95an9xNFSjCfsay6JZez7uv7yfW3Ad4ubc4fMK", - "tokenBReserve": "9wXqANaSuEqkKL9yHzCPEDGHwbkStVAqV5rB3QDs3Jr6", - "lpTokenSPL": "xETH89889mVRwsw9tSUnULsdLUPryTpijagy2YXxWyY" - }, - "tokenA": "ethereum", - "tokenB": "ethereum", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_xftt", - "relevantAccounts": { - "sunnyPool": "Ex33MaUfcdDUKfsdxsLWCqy4zEheQcLs8X45gBaiKJgF", - "tokenAMint": "Fr3W7NPVvdVbwMcHgA7Gx2wUxP43txdsn3iULJGFbKz9", - "tokenBMint": "EzfgjvkSwthhgHaceR3LnKXUoRkP6NUhfghdaHAj1tUv", - "tokenAReserve": "HHnpxMvDcXaeHXTSnWw9y8gMeUMnnCzxWfACgx839nCt", - "tokenBReserve": "Hk8UFqdvVdvJRZjKJV59PkrDrpLnbCCBMgDjVwx53cwi", - "lpTokenSPL": "xFTTLsMdN28XHtYTTTVWYz5zwXWBm5r1WTuZ7Cc7SyA" - }, - "tokenA": "ftx-token", - "tokenB": "ftx-token", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_xsol", - "relevantAccounts": { - "sunnyPool": "r5YY5McowCBago6oG1nFF3182Dw1XyKxMUE2CCyo3DT", - "tokenAMint": "BdUJucPJyjkHxLMv6ipKNUhSeY3DWrVtgxAES1iSBAov", - "tokenBMint": "So11111111111111111111111111111111111111112", - "tokenAReserve": "GSt31U8nF6WJBRG7j2EALfNTMd3J8jmotGX9szVTrzvN", - "tokenBReserve": "7WEqRDS5Dk6kVXFZHrsW5EtdPhy4v6jWK9P5jHhi9oz", - "lpTokenSPL": "xSoLVBNztDTUW8Kou2GJinHoe54Siu9Sk3e2uoU9aUi" - }, - "tokenA": "solana", - "tokenB": "solana", - "tvlReader": "sunnyQuarrySaberPoolReader" - }, - { - "poolName": "quarry_saber_xusd", - "relevantAccounts": { - "sunnyPool": "ESkFpDc7n9MzQeMnZC71WX8J4Q7dpehKonanYd6khccZ", - "tokenAMint": "83LGLCm7QKpYZbX8q4W2kYWbtt8NJBwbVwEepzkVnJ9y", - "tokenBMint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", - "tokenAReserve": "34M8pFVqgbV7aqHxvRT5tCv3vu2P1JJYT8J3VaxBK2oG", - "tokenBReserve": "3AZWBSze3ucsY3xSeuLne3b2pauVqiaJ1SZSV5T9WGWw", - "lpTokenSPL": "XUSDfnsgc2QYXRdbPAbMWoXCbBCCspRSvoGJ8o7RV9n" - }, - "tokenA": "usd-coin", - "tokenB": "usd-coin", - "tvlReader": "sunnyQuarrySaberPoolReader" - } -] \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/terra.js b/src/adapters/peggedAssets/llama-helper/terra.js deleted file mode 100644 index d9fd4847..00000000 --- a/src/adapters/peggedAssets/llama-helper/terra.js +++ /dev/null @@ -1,147 +0,0 @@ -const axios = require('axios') -const { default: BigNumber } = require("bignumber.js") -const sdk = require('@defillama/sdk') -const { usdtAddress } = require('./balances') - -async function query(url, block, phoenix = false) { - block = undefined - let endpoint = `${process.env["TERRA_RPC"] ?? `https://${phoenix ? 'phoenix-' : ''}lcd.terra.dev`}/wasm/${url}` - if (block !== undefined) { - endpoint += `&height=${block - (block % 100)}` - } - return (await axios.get(endpoint)).data.result -} - -const fetchAssets = async (path) => { - return (await axios.get(`https://assets.terra.money${path}`)) -} - -async function queryV1Beta1(url, paginationKey, block) { - let endpoint = `${process.env["TERRA_RPC"] ?? "https://lcd.terra.dev"}/cosmos/${url}` - if (block !== undefined) { - endpoint += `?height=${block - (block % 100)}` - } - if (paginationKey) { - const paginationQueryParam = `pagination.key=${paginationKey}` - if (block === undefined) { - endpoint += "?" - } else { - endpoint += "&" - } - endpoint += paginationQueryParam - } - return (await axios.get(endpoint)).data -} - - -async function getBalance(token, owner, block) { - const data = await query(`contracts/${token}/store?query_msg={"balance":{"address":"${owner}"}}`, block) - return Number(data.balance) -} - -async function getDenomBalance(denom, owner, block) { - let endpoint = `${process.env["TERRA_RPC"] ?? "https://lcd.terra.dev"}/bank/balances/${owner}` - if (block !== undefined) { - endpoint += `?height=${block - (block % 100)}` - } - const data = (await axios.get(endpoint)).data.result - - const balance = data.find(balance => balance.denom === denom); - return balance ? Number(balance.amount) : 0 -} - - -// LP stuff -async function totalSupply(token, block) { - return 0; - const data = await query(`contracts/${token}/store?query_msg={"token_info":{}}`, block) - return data.total_supply -} - -async function lpMinter(token, block) { - const data = await query(`contracts/${token}/store?query_msg={"minter":{}}`, block) - return data.minter -} - -function getAssetInfo(asset) { - return [asset.info.native_token?.denom ?? asset.info.token?.contract_addr, Number(asset.amount)] -} - -async function unwrapLp(balances, lpToken, lpBalance, block) { - const pair = await lpMinter(lpToken) - const { assets, total_share } = await query(`contracts/${pair}/store?query_msg={"pool":{}}`, block); - const [token0, amount0] = getAssetInfo(assets[0]) - const [token1, amount1] = getAssetInfo(assets[1]) - balances[token0] = (balances[token0] ?? 0) + (amount0 * lpBalance / total_share) - balances[token1] = (balances[token1] ?? 0) + (amount1 * lpBalance / total_share) -} - -const tokenMapping = { - 'terra1xfsdgcemqwxp4hhnyk4rle6wr22sseq7j07dnn': { label: 'KIJU', decimals: 6, }, - 'terra188w26t95tf4dz77raftme8p75rggatxjxfeknw': { label: 'sKIJU', decimals: 6, }, - 'terra15k5r9r8dl8r7xlr29pry8a9w7sghehcnv5mgp6': { coingeckoId: 'lunaverse', decimals: 6, }, - 'terra1cl7whtrqmz5ldr553q69qahck8xvk80fm33qjx': { label: 'ALTO', decimals: 6, }, - 'terra1dy9kmlm4anr92e42mrkjwzyvfqwz66un00rwr5': { coingeckoId: 'valkyrie-protocol', decimals: 6, }, - 'terra14z56l0fp2lsf86zy3hty2z47ezkhnthtr9yq76': { coingeckoId: 'anchor-protocol', decimals: 6, }, - 'terra15gwkyepfc6xgca5t5zefzwy42uts8l2m4g40k6': { coingeckoId: 'mirror-protocol', decimals: 6, }, - 'terra17y9qkl8dfkeg4py7n0g5407emqnemc3yqk5rup': { coingeckoId: 'stader-lunax', decimals: 6, }, - 'terra1hzh9vpxhsk8253se0vv5jj6etdvxu3nv8z07zu': { coingeckoId: 'anchorust', decimals: 6, }, - 'terra1kc87mu460fwkqte29rquh4hc20m54fxwtsx7gp': { coingeckoId: 'bonded-luna', decimals: 6, }, - 'uluna': { coingeckoId: 'terra-luna', decimals: 6, }, - 'uusd': { coingeckoId: 'terrausd', decimals: 6, }, - 'terra1dzhzukyezv0etz22ud940z7adyv7xgcjkahuun': { coingeckoId: 'anchor-beth-token', decimals: 6, }, - 'terra1z3e2e4jpk4n0xzzwlkgcfvc95pc5ldq0xcny58': { coingeckoId: 'avalanche-2', decimals: 6, }, - 'terra1nef5jf6c7js9x6gkntlehgywvjlpytm7pcgkn4': { label: 'LOOP', decimals: 6, }, - 'terra1vwz7t30q76s7xx6qgtxdqnu6vpr3ak3vw62ygk': { coingeckoId: 'luart', decimals: 6, }, - 'terra1xj49zyqrwpv5k928jwfpfy2ha668nwdgkwlrg3': { coingeckoId: 'astroport', decimals: 6, }, -} - -const TOKEN_LIST = Object.keys(tokenMapping).reduce((agg, key) => { - const { coingeckoId, label } = tokenMapping[key] - agg[coingeckoId || label] = key - return agg -}, {}) - -async function queryContractStore({ contract, queryParam, block }) { - if (typeof queryParam !== 'string') queryParam = JSON.stringify(queryParam) - const url = `contracts/${contract}/store?query_msg=${queryParam}` - return query(url, block) -} - -function sumSingleBalance(balances, token, balance, price) { - const { coingeckoId, label, decimals = 0, } = tokenMapping[token] || {} - - if (coingeckoId || (label && price)) { - token = coingeckoId || 'terrausd' - - if (decimals) - balance = BigNumber(balance).shiftedBy(-1 * decimals) - - if (!coingeckoId) - balance = balance.multipliedBy(BigNumber(price)) // convert the value to UST - - if (!balances[token]) - balances[token] = BigNumber(0) - else if (typeof balances[token] === 'string') - balances[token] = BigNumber(balances[token]).shiftedBy(-1 * decimals) - - balances[token] = balances[token].plus(balance) - return - } - - sdk.util.sumSingleBalance(balances, token, balance) - return balances -} - -module.exports = { - totalSupply, - getBalance, - getDenomBalance, - unwrapLp, - query, - queryV1Beta1, - fetchAssets, - queryContractStore, - sumSingleBalance, - TOKEN_LIST, -} diff --git a/src/adapters/peggedAssets/llama-helper/tezos.js b/src/adapters/peggedAssets/llama-helper/tezos.js deleted file mode 100644 index c0e04715..00000000 --- a/src/adapters/peggedAssets/llama-helper/tezos.js +++ /dev/null @@ -1,133 +0,0 @@ -const http = require('./http') -const sdk = require('@defillama/sdk') -const { getChainTransform } = require('./portedTokens') -const { default: BigNumber } = require('bignumber.js') -const { usdtAddress, toUSDTBalances } = require('../helper/balances') -const { PromisePool } = require('@supercharge/promise-pool') - -const RPC_ENDPOINT = 'https://api.tzkt.io' - -async function getTokenBalances(account, includeTezosBalance = true) { - const response = await http.get(`${RPC_ENDPOINT}/v1/tokens/balances?account=${account}&sort.desc=balance&offset=0&limit=40&select=balance,token.id%20as%20id,token.contract%20as%20contract,token.tokenId%20as%20token_id`) - const balances = response.reduce((agg, item) => { - let token = item.contract.address - if (item.token_id !== '0') token += '-' + item.token_id - agg[token] = item.balance - return agg - }, {}) - - if (includeTezosBalance) - balances['tezos'] = await getTezosBalance(account) - - if (balances.tezos === 0) delete balances.tezos - return balances -} - -async function getTezosBalance(account) { - const balance = await http.get(`${RPC_ENDPOINT}/v1/accounts/${account}/balance`) - return +balance / 10 ** 6 -} - -async function getStorage(account) { - return http.get(`${RPC_ENDPOINT}/v1/contracts/${account}/storage`) -} - -async function addDexPosition({ balances = {}, account, transformAddress }) { - if (!transformAddress) transformAddress = await getChainTransform('tezos') - const tokenBalances = await getTokenBalances(account) - Object.keys(tokenBalances).forEach(token => sdk.util.sumSingleBalance(balances, transformAddress(token), tokenBalances[token])) - return balances -} - -async function resolveLPPosition({ balances = {}, owner, lpToken, transformAddress, ignoreList = [] }) { - if (!transformAddress) transformAddress = await getChainTransform('tezos') - const LPBalances = await getTokenBalances(owner) - if (!LPBalances[lpToken]) return balances - const data = await getStorage(lpToken) - const admin = data.admin || data.exchangeAddress - const total_supply = data.total_supply || data.totalSupply - - if (ignoreList.includes(admin)) - return balances - - const tokenBalances = await getTokenBalances(admin) - const ownershipRatio = BigNumber(LPBalances[lpToken]).dividedBy(total_supply) - Object.keys(tokenBalances).forEach(token => { - const balance = BigNumber(tokenBalances[token]).multipliedBy(ownershipRatio).toFixed(0) - sdk.util.sumSingleBalance(balances, transformAddress(token), balance) - }) - return balances -} - -async function sumTokens({ owners = [], balances = {}, includeTezos = false }) { - const { errors } = await PromisePool.withConcurrency(10) - .for(owners) - .process(async item => { - const balance = await getTokenBalances(item, includeTezos) - Object.entries(balance).forEach(([token, bal]) => sdk.util.sumSingleBalance(balances, token, bal)) - }) - - if (errors && errors.length) - throw errors[0] - - return balances -} - -function fetchPrice() { - return http.get('https://api.teztools.io/token/prices') -} - - -let pricePromise - -async function getPrices() { - if (!pricePromise) pricePromise = fetchPrice() - const { contracts: pricesArray } = await pricePromise - const priceObj = {} - pricesArray.forEach(p => { - let label = p.tokenAddress - if (p.hasOwnProperty('tokenId') && p.tokenId !== 0) label += '-' + p.tokenId - priceObj[label] = p - }) - return priceObj -} - -async function convertBalances(balances) { - let totalUSD = 0 - const prices = await getPrices() - const response = {} - Object.entries(balances).forEach(([token, balance]) => { - if (token === 'tezos') return; - if (!prices[token]) { - response[token] = balance - return; - } - const { decimals, usdValue, } = prices[token] - if (!usdValue) return; - totalUSD += (+balance / 10 ** decimals) * usdValue - }) - - response[usdtAddress] = totalUSD * 1e6 - if (balances.tezos) response.tezos = balances.tezos - return response -} - -async function getLPs(dex) { - if (!pricePromise) pricePromise = fetchPrice() - const { contracts } = await pricePromise - const LPs = {} - for (const { pairs } of contracts) - pairs.filter(p => p.dex === dex).forEach(p => LPs[p.address] = p) - return Object.keys(LPs) -} - -module.exports = { - RPC_ENDPOINT, - getStorage, - sumTokens, - convertBalances, - getTokenBalances, - addDexPosition, - resolveLPPosition, - getLPs, -} diff --git a/src/adapters/peggedAssets/llama-helper/tokenholders.js b/src/adapters/peggedAssets/llama-helper/tokenholders.js deleted file mode 100644 index e752224b..00000000 --- a/src/adapters/peggedAssets/llama-helper/tokenholders.js +++ /dev/null @@ -1,58 +0,0 @@ -const { sumTokens } = require('./unwrapLPs') -const sdk = require('@defillama/sdk') - - -const WETH = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2" - -function normalizeArray(arrayOrString){ - if(Array.isArray(arrayOrString)){ - return arrayOrString - }else { - return [arrayOrString] - } -} - -function tokenHolderBalances(tokenHolderMap, chain = 'ethereum') { - return async (timestamp, block, chainBlocks) => { - if (chain !== 'ethereum') block = chainBlocks[chain] - const tokensAndHolders = [] - let ethHolders = [] - for (const group of tokenHolderMap) { - const holders = normalizeArray(group.holders); - const tokens = normalizeArray(group.tokens) - if (group.checkETHBalance === true) { - ethHolders = ethHolders.concat(holders) - } - tokens.forEach(token => { - holders.forEach(holder => { - tokensAndHolders.push([token, holder]) - }) - }) - } - - const balances = {}; - await sumTokens(balances, tokensAndHolders, block, chain); - if (ethHolders.length > 0) { - const ethBalances = await sdk.api.eth.getBalances({ - targets: ethHolders, - block, - chain, - }) - let nativeToken = WETH - switch (chain) { - case 'bsc': nativeToken = 'bsc:0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c'; break; // wbnb - case 'polygon': nativeToken = '0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0'; break; // matic - case 'xdai': nativeToken = '0x6b175474e89094c44da98b954eedeac495271d0f'; break; // xdai - case 'avax': nativeToken = 'avax:0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7'; break; // avax - } - ethBalances.output.forEach(ethBal => { - sdk.util.sumSingleBalance(balances, nativeToken, ethBal.balance) - }) - } - return balances - } -} - -module.exports = { - tokenHolderBalances -} \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/tomb.js b/src/adapters/peggedAssets/llama-helper/tomb.js deleted file mode 100644 index 79ea38a4..00000000 --- a/src/adapters/peggedAssets/llama-helper/tomb.js +++ /dev/null @@ -1,93 +0,0 @@ -const { staking, stakingUnknownPricedLP } = require("./staking"); -const { pool2Exports } = require("./pool2"); -const sdk = require("@defillama/sdk"); -const token0Abi = require("./abis/token0.json"); -const token1Abi = require("./abis/token1.json"); -const { default: BigNumber } = require("bignumber.js"); - -function tombTvl(token, share, rewardPool, masonry, pool2LPs, chain = "ethereum", transform = undefined, tokensOnCoingecko = true, lpWithShare = undefined) { - if (transform === undefined) transform = addr => `${chain}:${addr}`; - if (tokensOnCoingecko) { - return { - [chain === "avax" ? "avalanche" : chain]: { - tvl: async () => ({}), - staking: staking(masonry, share, chain), - pool2: pool2Exports(rewardPool, pool2LPs, chain, transform) - } - } - } - else if (!tokensOnCoingecko) { - const pool2 = async (timestamp, block, chainBlocks) => { - let balances = {}; - token = token.toLowerCase(); - share = share.toLowerCase(); - block = chainBlocks[chain]; - const pool2Balances = (await sdk.api.abi.multiCall({ - calls: pool2LPs.map(p => ({ - target: p, - params: rewardPool - })), - abi: "erc20:balanceOf", - block, - chain - })).output; - const supplies = (await sdk.api.abi.multiCall({ - calls: pool2LPs.map(p => ({ - target: p - })), - abi: "erc20:totalSupply", - block, - chain - })).output; - const pool2Token0 = (await sdk.api.abi.multiCall({ - calls: pool2LPs.map(p => ({ - target: p - })), - abi: token0Abi, - block, - chain - })).output; - const pool2Token1 = (await sdk.api.abi.multiCall({ - calls: pool2LPs.map(p => ({ - target: p - })), - abi: token1Abi, - block, - chain - })).output; - - for (let i = 0; i < pool2LPs.length; i++) { - let listedToken; - const token0 = pool2Token0[i].output.toLowerCase(); - const token1 = pool2Token1[i].output.toLowerCase(); - if (token0 === token || token0 === share) { - listedToken = token1; - } - else if (token1 === token || token1 === share) { - listedToken = token0; - } - const listedTokenBalance = (await sdk.api.erc20.balanceOf({ - target: listedToken, - owner: pool2LPs[i], - block, - chain - })).output; - const balance = BigNumber(pool2Balances[i].output).times(listedTokenBalance).div(supplies[i].output).times(2).toFixed(0); - sdk.util.sumSingleBalance(balances, transform(listedToken), balance); - } - return balances - } - - return { - [chain === "avax" ? "avalanche" : chain]: { - tvl: async () => ({}), - staking: stakingUnknownPricedLP(masonry, share, chain, lpWithShare), - pool2 - } - } - } -} - -module.exports = { - tombTvl -} \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/unicrypt.js b/src/adapters/peggedAssets/llama-helper/unicrypt.js deleted file mode 100644 index 2871d2cb..00000000 --- a/src/adapters/peggedAssets/llama-helper/unicrypt.js +++ /dev/null @@ -1,281 +0,0 @@ -const BigNumber = require('bignumber.js'); -const sdk = require('@defillama/sdk'); - -const { unwrapUniswapLPs } = require("./unwrapLPs"); - -const token0 = require('./abis/token0.json'); -const token1 = require('./abis/token1.json'); - -const getPairFactory = require('./abis/getPair.json') - - -async function getUnicryptLpsCoreValue( - block, - chain, - contract, // locker contract address. - getNumLockedTokensABI, // ABI to retrieve the total amount of tokens locked. - getLockedTokenAtIndexABI, // ABI to retrieve tokens at a specific lock index. - trackedTokens = [], // liquid assets for tokens to be paired against (ETH, USD etc.). - pool2 = [], // pool2 pair to be excluded from the balances. - isMixedTokenContract = false, - factory = null - ) { - - let balances = {} - - const getLocks = Number( - ( - await sdk.api.abi.call({ - abi: getNumLockedTokensABI, - target: contract, - chain: chain, - block: block, - }) - ).output - ); - - let lockedLPs = []; - const lockIds = Array.from(Array(getLocks).keys()); - { - - const lps = ( - await sdk.api.abi.multiCall({ - abi: getLockedTokenAtIndexABI, - calls: lockIds.map((lockid) => ({ - target: contract, - params: lockid, - })), - chain: chain, - block: block, - }) - ) - .output - - lps.forEach(lp => { - if (lp.success && (!pool2.includes(lp))) { - const lpToken = lp.output.toLowerCase() - lockedLPs.push(lpToken) - } - }) -} - - return (isMixedTokenContract) ? // check if purely an lp locker or contains lps and tokens - getTokensAndLPsTrackedValue(balances, lockedLPs, contract, factory, trackedTokens, block, chain) : - getLPsTrackedValue(balances, lockedLPs, contract, factory, trackedTokens, block, chain) -} - - -async function getTokensAndLPsTrackedValue(balances, lpTokens, contract, factory, trackedTokens, block, chain) { - - if (!Array.isArray(trackedTokens)) throw new Error("must pass an array of base tokens to trackedTokens") - - const [token0Addresses, token1Addresses, tokenBalances] = await Promise.all([ - sdk.api.abi - .multiCall({ - abi: token0, - chain, - calls: lpTokens.map((lpToken) => ({ - target: lpToken, - })), - block, - }) - .then(({ output }) => output), - sdk.api.abi - .multiCall({ - abi: token1, - chain, - calls: lpTokens.map((lpToken) => ({ - target: lpToken, - })), - block, - }).then(({ output }) => output), - sdk.api.abi.multiCall({ - abi: "erc20:balanceOf", - chain, - calls: lpTokens.map(lpToken => ({ - target: lpToken, - params: contract, - })), - block, - }).then(({ output }) => output) - ]); - - let lps = {} - let filteredLps = {} - let lpBalances = [] - - - tokenBalances.forEach((balance) => { - if (balance.success) { - const lpBalance = balance.output - const lpAddress = balance.input.target.toLowerCase() - lps[lpAddress] = { - balance: lpBalance, - } - } - }); - - token0Addresses.forEach((token0Address) => { - if (token0Address.success) { - const pairAddress = token0Address.input.target.toLowerCase(); - lps[pairAddress].token0 = token0Address.output - } - }); - - token1Addresses.forEach((token1Address) => { - if (token1Address.success) { - const pairAddress = token1Address.input.target.toLowerCase(); - lps[pairAddress].token1 = token1Address.output - } - }); - - Object.entries(lps).forEach(([key, value]) => { - if (value.token0 && value.token1 && value.balance) { - if (value.balance > 0) { - filteredLps[key] = {balance: value.balance} - filteredLps[key].token0 = value.token0 - filteredLps[key].token1 = value.token1 - } - } - }) - - // Check if token is actually a v2 pair - {const checkedLPToken = ( - await sdk.api.abi.multiCall({ - abi: getPairFactory, - calls: Object.values(filteredLps).map((value) => ({ - target: factory, - params: [value.token0, value.token1], - })), - chain: chain, - block: block, - }) - ).output - - checkedLPToken.forEach(lp => { - if (lp.success) { - const lpToken = lp.output.toLowerCase() - if (lp.success && Object.keys(filteredLps).includes(lpToken)) { - // check if pair contains both base tokens - let lpBalance = - ((trackedTokens.includes(filteredLps[lpToken].token0) && - trackedTokens.includes(filteredLps[lpToken].token1))) ? - filteredLps[lpToken].balance : - BigNumber(filteredLps[lpToken].balance).times(BigNumber(2)).toFixed(0) - - lpBalances.push({ - balance: lpBalance, - token: lpToken - })} - } - }) - } - - await unwrapUniswapLPs(balances, lpBalances, block, chain, (addr) => `${chain}:${addr}`); - - - let formattedWhitelist = trackedTokens.map(address => `${chain}:${address}`) - - balances = Object.keys(balances) - .filter(balance => formattedWhitelist.includes(balance)) - .reduce((obj, balance) => { - obj[balance] = balances[balance]; - return obj; - }, {}); - - return balances; -} - -async function getLPsTrackedValue(balances, lpTokens, contract, factory, trackedTokens, block, chain) { - - if (!Array.isArray(trackedTokens)) throw new Error("must pass an array of base tokens to trackedTokens") - - // get pairs made of 2 core assets to avoid double counting their balances - - let matchedBaseTokens = [] - if (trackedTokens.length > 1) { - trackedTokens.forEach(token0 => - trackedTokens.forEach(token1 => { - if (!(token0 == token1)) - matchedBaseTokens.push([token0, token1]) - })) - } - - let whitelistedBasePairs = new Set() - -{ const basePairs = ( - await sdk.api.abi.multiCall({ - abi: getPairFactory, - calls: Object.values(matchedBaseTokens).map((value) => ({ - target: factory, - params: value, - })), - chain: chain, - block: block, - }) - ).output - - basePairs.forEach(pair => { - if (pair.success) { - const basePair = pair.output.toLowerCase() - if (basePair != '0x0000000000000000000000000000000000000000') - whitelistedBasePairs.add(basePair)} - } - ) -} - - let lps = [] -{ - const tokenBalances = (await sdk.api.abi.multiCall({ - abi: "erc20:balanceOf", - calls: lpTokens.map((lpToken) => ({ - target: lpToken, - params: contract, - })), - chain: chain, - block: block, - })).output - - - tokenBalances.forEach((balance) => { - if (balance.success) { - const lpAddress = balance.input.target.toLowerCase() - let lpBalance = (whitelistedBasePairs.has(lpAddress)) ? - balance.output : BigNumber(balance.output).times(BigNumber(2)).toFixed(0) - if (lpBalance > 0) { - lps[lpAddress] = lpBalance - } - } - }); -} - -let lpBalances = [] - - Object.entries(lps).forEach(([key, value]) => { - lpBalances.push({ - balance: value, - token: key - }) - }) - - await unwrapUniswapLPs(balances, lpBalances, block, chain, (addr) => `${chain}:${addr}`); - - let formattedWhitelist = trackedTokens.map(address => `${chain}:${address}`) - - balances = Object.keys(balances) - .filter(balance => formattedWhitelist.includes(balance)) - .reduce((obj, balance) => { - obj[balance] = balances[balance]; - return obj; - }, {}); - - return balances; -} - - -module.exports = { - getUnicryptLpsCoreValue, - getTokensAndLPsTrackedValue, - getLPsTrackedValue -} - diff --git a/src/adapters/peggedAssets/llama-helper/unifarm.js b/src/adapters/peggedAssets/llama-helper/unifarm.js deleted file mode 100644 index 5a733683..00000000 --- a/src/adapters/peggedAssets/llama-helper/unifarm.js +++ /dev/null @@ -1,109 +0,0 @@ -const axios = require("axios"); - -const ETH_CHAIN = "ethereum"; -const BSC_CHAIN = "bsc"; -const POLYGON_CHAIN = "polygon"; - -const ETH_TOKENLIST = - "https://raw.githubusercontent.com/InfernalHeir/tokenlist/mainnet-01/unifarm-tokenlist.json"; -const BSC_TOKENLIST = - "https://raw.githubusercontent.com/InfernalHeir/tokenlist/mainnet-01/unifarm.tokenlist.56.json"; -const POLYGON_TOKENLIST = - "https://raw.githubusercontent.com/InfernalHeir/tokenlist/mainnet-01/unifarm.tokenlist.137.json"; - -const GRAPH_ENDPOINT = "https://graph.unifarm.co/graphql"; - -const QUERY = ` -query GetCohort($where: CohortGroupWhereClause!) { - allCohortsAndProxies(where: $where) { - cohortAddress - proxies - } -} -`; - -const getCohortTokens = async (url) => { - const results = await axios.get(url); - return results.data.tokenlist; -}; - -const getCohortTokensByChainName = async (chain) => { - switch (chain) { - case ETH_CHAIN: - return await getCohortTokens(ETH_TOKENLIST); - case BSC_CHAIN: - return await getCohortTokens(BSC_TOKENLIST); - case POLYGON_CHAIN: - return await getCohortTokens(POLYGON_TOKENLIST); - default: - break; - } -}; - -const getCohortAndProxies = async (chainId) => { - try { - const results = await axios.post( - GRAPH_ENDPOINT, - JSON.stringify({ - query: QUERY, - variables: { - where: { - chainId, - }, - }, - }), - { - headers: { - "Content-Type": "application/json", - }, - } - ); - return results.data.data.allCohortsAndProxies; - } catch (err) { - console.log(err.message); - } -}; - -const getCohortsAndProxiesByChain = async (chain) => { - switch (chain) { - case ETH_CHAIN: - return getCohortAndProxies(1); - case BSC_CHAIN: - return getCohortAndProxies(56); - case POLYGON_CHAIN: - return getCohortAndProxies(137); - default: - return null; - } -}; - -const createCalls = (tokens, cohortId) => { - return tokens.map((items) => { - return { - target: items.address, - params: [cohortId], - }; - }); -}; - -const createMulticalls = (cohortAndProxies, tokens) => { - let calls = []; - for (var u = 0; u < cohortAndProxies.length; u++) { - const items = cohortAndProxies[u]; - const cohortId = items.cohortAddress; - const proxies = items.proxies; - calls.push(...createCalls(tokens, cohortId)); - if (proxies && proxies[0] !== undefined) { - for (var k = 0; k < proxies.length; k++) { - calls.push(...createCalls(tokens, proxies[k])); - } - } - } - return calls; -}; - -module.exports = { - createMulticalls, - getCohortTokensByChainName, - getCohortsAndProxiesByChain, -}; diff --git a/src/adapters/peggedAssets/llama-helper/unknownTokens.js b/src/adapters/peggedAssets/llama-helper/unknownTokens.js deleted file mode 100644 index 054d4a9e..00000000 --- a/src/adapters/peggedAssets/llama-helper/unknownTokens.js +++ /dev/null @@ -1,395 +0,0 @@ - -const sdk = require('@defillama/sdk'); -const symbol = require('./abis/symbol.json') -const token0 = require('./abis/token0.json'); -const token1 = require('./abis/token1.json'); -const getReserves = require('./abis/getReserves.json'); -const { getChainTransform, stripTokenHeader, getFixBalances, } = require('./portedTokens') -const { requery, } = require('./getUsdUniTvl') -const { sumTokens, } = require('./unwrapLPs') -const { isLP, getUniqueAddresses, DEBUG_MODE } = require('./utils') -const factoryAbi = require('./abis/factory.json'); -const { getBlock } = require('./getBlock'); -const { default: BigNumber } = require('bignumber.js') - -async function getLPData({ - block, - chain = 'ethereum', - lps = [], // list of token addresses (all need not be LPs, code checks and filters out non LPs) - allLps = false, // if set true, assumes all tokens provided as lps are lps and skips validation/filtering -}) { - lps = getUniqueAddresses(lps) - const pairAddresses = allLps ? lps : await getLPList(lps) - const pairCalls = pairAddresses.map((pairAddress) => ({ target: pairAddress, })) - let token0Addresses, token1Addresses, reserves - - [token0Addresses, token1Addresses, reserves] = await Promise.all([ - sdk.api.abi.multiCall({ abi: token0, chain, calls: pairCalls, block, }).then(({ output }) => output), - sdk.api.abi.multiCall({ abi: token1, chain, calls: pairCalls, block, }).then(({ output }) => output), - ]); - await requery(token0Addresses, chain, block, token0); - await requery(token1Addresses, chain, block, token1); - const pairs = {}; - // add token0Addresses - token0Addresses.forEach((token0Address) => - pairs[token0Address.input.target] = { - token0Address: token0Address.output.toLowerCase(), - } - ) - token1Addresses.forEach((token1Address) => { - if (!pairs[token1Address.input.target]) pairs[token1Address.input.target] = {} - pairs[token1Address.input.target].token1Address = token1Address.output.toLowerCase() - }) - return pairs - - async function getLPList(lps) { - const callArgs = lps.map(t => ({ target: t })) - let symbols = (await sdk.api.abi.multiCall({ calls: callArgs, abi: symbol, block, chain })).output - symbols = symbols.filter(item => isLP(item.output, item.input.target, chain)) - // if (DEBUG_MODE) console.log(symbols.filter(item => item.output !== 'Cake-LP').map(i => `token: ${i.input.target} Symbol: ${i.output}`).join('\n')) - if (DEBUG_MODE) console.log('LP symbols:', getUniqueAddresses(symbols.map(i => i.output)).join(', ')) - return symbols.map(item => item.input.target.toLowerCase()) - } -} - -async function getTokenPrices({ - block, - chain = 'ethereum', - coreAssets = [], // list of tokens that can used as base token to price unknown tokens against (Note: order matters, is there are two LPs for a token, the core asset with a lower index is used) - blacklist = [], // list of tokens to ignore/blacklist - whitelist = [], // if set, tvl/price is computed only for these tokens - lps = [], // list of token addresses (all need not be LPs, code checks and filters out non LPs) - transformAddress, // function for transforming token address to coingecko friendly format - allLps = false, // if set true, assumes all tokens provided as lps are lps and skips validation/filtering - minLPRatio = 0.5, // if a token pool has less that this percent of core asset tokens compared to a token pool with max tokens for a given core asset, this token pool is not used for price calculation - restrictTokenPrice = false, // if enabled, while computed tvl, an unknown token value can max - log_coreAssetPrices = [], - log_minTokenValue = 1e6 // log only if token value is higer than this value, now minimum is set as 1 million -}) { - let counter = 0 - if (!transformAddress) - transformAddress = await getChainTransform(chain) - - coreAssets = coreAssets.map(i => i.toLowerCase()) - blacklist = blacklist.map(i => i.toLowerCase()) - whitelist = whitelist.map(i => i.toLowerCase()) - lps = getUniqueAddresses(lps) - const pairAddresses = allLps ? lps : await getLPList(lps) - const pairCalls = pairAddresses.map((pairAddress) => ({ target: pairAddress, })) - - let token0Addresses, token1Addresses, reserves - - [token0Addresses, token1Addresses, reserves] = await Promise.all([ - sdk.api.abi.multiCall({ abi: token0, chain, calls: pairCalls, block, }).then(({ output }) => output), - sdk.api.abi.multiCall({ abi: token1, chain, calls: pairCalls, block, }).then(({ output }) => output), - sdk.api.abi.multiCall({ abi: getReserves, chain, calls: pairCalls, block, }).then(({ output }) => output), - ]); - await requery(token0Addresses, chain, block, token0); - await requery(token1Addresses, chain, block, token1); - await requery(reserves, chain, block, getReserves); - - - const pairs = {}; - // add token0Addresses - token0Addresses.forEach((token0Address) => { - const tokenAddress = token0Address.output.toLowerCase(); - - const pairAddress = token0Address.input.target.toLowerCase(); - pairs[pairAddress] = { - token0Address: tokenAddress, - } - }); - - // add token1Addresses - token1Addresses.forEach((token1Address) => { - const tokenAddress = token1Address.output.toLowerCase(); - const pairAddress = token1Address.input.target.toLowerCase(); - pairs[pairAddress] = { - ...(pairs[pairAddress] || {}), - token1Address: tokenAddress, - } - }); - - const prices = {} - const pairBalances = {} - - for (let i = 0; i < reserves.length; i++) { - const pairAddress = reserves[i].input.target.toLowerCase(); - const pair = pairs[pairAddress]; - pairBalances[pairAddress] = {} - const token0Address = pair.token0Address.toLowerCase() - const token1Address = pair.token1Address.toLowerCase() - const reserveAmounts = reserves[i].output - if (coreAssets.includes(token0Address) && coreAssets.includes(token1Address)) { - sdk.util.sumSingleBalance(pairBalances[pairAddress], token0Address, Number(reserveAmounts[0])) - sdk.util.sumSingleBalance(pairBalances[pairAddress], token1Address, Number(reserveAmounts[1])) - } else if (coreAssets.includes(token0Address)) { - sdk.util.sumSingleBalance(pairBalances[pairAddress], token0Address, Number(reserveAmounts[0]) * 2) - if (!blacklist.includes(token1Address) && (!whitelist.length || whitelist.includes(token1Address))) { - setPrice(prices, token1Address, reserveAmounts[0], reserveAmounts[1], token0Address) - } - } else if (coreAssets.includes(token1Address)) { - if (!reserveAmounts) console.log('missing reserves', pairAddress) - sdk.util.sumSingleBalance(pairBalances[pairAddress], token1Address, Number(reserveAmounts[1]) * 2) - if (!blacklist.includes(token0Address) && (!whitelist.length || whitelist.includes(token0Address))) { - setPrice(prices, token0Address, reserveAmounts[1], reserveAmounts[0], token1Address) - } - } else { - const isWhitelistedToken0 = !blacklist.includes(token0Address) - const isWhitelistedToken1 = !blacklist.includes(token1Address) - if (isWhitelistedToken0 && isWhitelistedToken1) { - sdk.util.sumSingleBalance(pairBalances[pairAddress], token0Address, Number(reserveAmounts[0])) - sdk.util.sumSingleBalance(pairBalances[pairAddress], token1Address, Number(reserveAmounts[1])) - } else if (isWhitelistedToken0) { - sdk.util.sumSingleBalance(pairBalances[pairAddress], token0Address, Number(reserveAmounts[0]) * 2) - } else if (isWhitelistedToken1) { - sdk.util.sumSingleBalance(pairBalances[pairAddress], token1Address, Number(reserveAmounts[1]) * 2) - } - } - } - - filterPrices(prices) - const balances = {} - Object.keys(pairBalances).forEach(key => addBalances(pairBalances[key], balances, { pairAddress: key })) - const fixBalances = await getFixBalances(chain) - fixBalances(balances) - - return { - pairs, - updateBalances, - pairBalances, - prices, - balances, - } - - async function getLPList(lps) { - const callArgs = lps.map(t => ({ target: t })) - let symbols = (await sdk.api.abi.multiCall({ calls: callArgs, abi: symbol, block, chain })).output - symbols = symbols.filter(item => isLP(item.output, item.input.target, chain)) - // if (DEBUG_MODE) console.log(symbols.filter(item => item.output !== 'Cake-LP').map(i => `token: ${i.input.target} Symbol: ${i.output}`).join('\n')) - if (DEBUG_MODE) console.log('LP symbols:', getUniqueAddresses(symbols.map(i => i.output)).join(', ')) - return symbols.map(item => item.input.target.toLowerCase()) - } - - function setPrice(prices, address, coreAmount, tokenAmount, coreAsset) { - if (prices[address] !== undefined) { - const currentCoreAmount = prices[address][0] - const currentCoreAsset = prices[address][2] - // core asset higher on the list has higher preference - if (coreAssets.indexOf(currentCoreAmount) < coreAssets.indexOf(coreAsset)) return; - if ((currentCoreAsset === coreAsset) && coreAmount < currentCoreAmount) return; - } - if (Number(tokenAmount) > 0) - prices[address] = [Number(coreAmount), Number(coreAmount) / Number(tokenAmount), coreAsset, +Number(tokenAmount)] - } - - function getAssetPrice(asset) { - const assetIndex = coreAssets.indexOf(asset.toLowerCase()) - if (assetIndex === -1 || !log_coreAssetPrices[assetIndex]) return 1 / 1e18 - return log_coreAssetPrices[assetIndex] - } - - async function updateBalances(balances, { resolveLP = true, skipConversion = false, onlyLPs = false, } = {}) { - let lpAddresses = [] // if some of the tokens in balances are LP tokens, we resolve those as well - if (DEBUG_MODE) console.log('---updating balances-----') - const finalBalances = onlyLPs ? {} : balances - counter = 0 - Object.entries(balances).forEach(([address, amount = 0]) => { - const token = stripTokenHeader(address) - const price = prices[token]; - if (pairBalances[token]) { - lpAddresses.push(token) - return; - } - if (!price || skipConversion) return; - let tokenAmount = price[1] * +amount - const coreAsset = price[2] - const tokensInLP = price[3] - const coreTokenAmountInLP = price[0] - if (restrictTokenPrice && +amount > tokensInLP) tokenAmount = coreTokenAmountInLP // use token amount in pool if balances amount is higher than amount in pool - if (DEBUG_MODE && tokenAmount * getAssetPrice(coreAsset) > log_minTokenValue) - console.log(`[converting balances] token vaule (in millions): ${(tokenAmount * getAssetPrice(coreAsset) / 1e6).toFixed(4)}, token value higher than pool: ${+amount > +tokensInLP} token: ${token} counter: ${++counter}`) - sdk.util.sumSingleBalance(balances, transformAddress(coreAsset), BigNumber(tokenAmount).toFixed(0)) - delete balances[address] - }) - - if (!resolveLP) return balances - - if (lpAddresses.length) { - const totalBalances = (await sdk.api.abi.multiCall({ - abi: 'erc20:totalSupply', calls: lpAddresses.map(i => ({ target: i })), block, chain - })).output - - totalBalances.forEach((item) => { - const token = item.input.target - const address = transformAddress(token) - const ratio = +item.output > 0 ? (+(balances[address]) || 0) / +item.output : 0 - addBalances(pairBalances[token], finalBalances, { ratio, pairAddress: token, skipConversion, }) - delete balances[address] - }) - } - - return finalBalances - } - - - function addBalances(balances, finalBalances, { skipConversion = false, pairAddress, ratio = 1 }) { - if (ratio > 1) { - console.log(`There is bug in the code. Pair address: ${pairAddress}, ratio: ${ratio}`) - ratio = 1 - } - Object.entries(balances).forEach(([address, amount = 0]) => { - const price = prices[address]; - // const price = undefined; // NOTE: this is disabled till, we add a safeguard to limit LP manipulation to inflate token price, like mimimum core asset liquidity to be 10k - if (price && !skipConversion) { - const coreTokenAmountInLP = price[0] - const coreAsset = price[2] - const tokensInLP = price[3] - let tokenAmount = price[1] * +amount - if (restrictTokenPrice && +amount > tokensInLP) tokenAmount = coreTokenAmountInLP - if (DEBUG_MODE && tokenAmount * getAssetPrice(coreAsset) * ratio > log_minTokenValue) - console.log(`[resolve LP balance] token vaule (in millions): ${(tokenAmount * getAssetPrice(coreAsset) * ratio / 1e6).toFixed(4)}, token value higher than pool: ${+amount > +tokensInLP} LP Address: ${pairAddress} token: ${address} ratio: ${ratio} counter: ${++counter}`) - sdk.util.sumSingleBalance(finalBalances, transformAddress(coreAsset), BigNumber(tokenAmount * ratio).toFixed(0)) - } else { - if ((DEBUG_MODE && coreAssets.includes(address)) && (+amount * getAssetPrice(address) * ratio > log_minTokenValue)) - console.log(`[resolve LP balance] token vaule (in millions): ${(+amount * getAssetPrice(address) * ratio / 1e6).toFixed(4)}, LP Address: ${pairAddress} core token: ${address} ratio: ${ratio} counter: ${++counter}`) - sdk.util.sumSingleBalance(finalBalances, transformAddress(address), BigNumber(+amount * ratio).toFixed(0)) - } - }) - } - - // If we fetch prices from pools with low liquidity, the value of tokens can be absurdly high, so we set a threshold that if we are using a core asset to determine price, - // the amount of said core asset in a pool from which price is fetched must be at least 0.5% of the amount of core asset tokens in pool with highest core asset tokens - function filterPrices(prices) { - const maxCoreTokens = {} - Object.values(prices).forEach(([amount, _, coreAsset]) => { - if (!maxCoreTokens[coreAsset] || maxCoreTokens[coreAsset] < +amount) - maxCoreTokens[coreAsset] = +amount - }) - - Object.keys(prices).forEach(token => { - const priceArry = prices[token] - const [amount, _, coreAsset] = priceArry - if (!maxCoreTokens[coreAsset]) throw new Error('there is bug in the code') - const lpRatio = +amount * 100 / maxCoreTokens[coreAsset] - if (lpRatio < minLPRatio) delete prices[token] // current pool has less than 0.5% of tokens compared to pool with highest number of core tokens - }) - } -} - -function getUniTVL({ chain = 'ethereum', coreAssets = [], blacklist = [], whitelist = [], factory, transformAddress, allowUndefinedBlock = true, - minLPRatio = 1, - log_coreAssetPrices = [], log_minTokenValue = 1e6, - withMetaData = false, -}) { - return async (ts, _block, chainBlocks) => { - let pairAddresses; - const block = await getBlock(ts, chain, chainBlocks, allowUndefinedBlock) - const pairLength = (await sdk.api.abi.call({ target: factory, abi: factoryAbi.allPairsLength, chain, block })).output - if (pairLength === null) - throw new Error("allPairsLength() failed") - - if (DEBUG_MODE) console.log('No. of pairs: ', pairLength) - - const pairNums = Array.from(Array(Number(pairLength)).keys()) - let pairs = (await sdk.api.abi.multiCall({ abi: factoryAbi.allPairs, chain, calls: pairNums.map(num => ({ target: factory, params: [num] })), block, requery: true })).output - await requery(pairs, chain, block, factoryAbi.allPairs); - - pairAddresses = pairs.map(result => result.output.toLowerCase()) - - const response = await getTokenPrices({ - block, chain, coreAssets, blacklist, lps: pairAddresses, transformAddress, whitelist, allLps: true, - minLPRatio, log_coreAssetPrices, log_minTokenValue, - }) - return withMetaData ? response : response.balances - } -} - -function unknownTombs({ token, shares = [], rewardPool = [], masonry = [], lps, chain = "ethereum", coreAssets = [], }) { - let getPrices - - if (!Array.isArray(shares) && typeof shares === 'string') - shares = [shares] - if (!Array.isArray(masonry) && typeof masonry === 'string') - masonry = [masonry] - if (!Array.isArray(rewardPool) && typeof rewardPool === 'string') - rewardPool = [rewardPool] - - const pool2 = async (timestamp, _block, chainBlocks) => { - let balances = {}; - const block = chainBlocks[chain] - if (!getPrices) - getPrices = getTokenPrices({ block, chain, lps, coreAssets, allLps: true }) - - const { updateBalances } = await getPrices - - const tao = [] - lps.forEach(token => rewardPool.forEach(owner => tao.push([token, owner]))) - - await sumTokens(balances, tao, block, chain, undefined, { resolveLP: true }) - await updateBalances(balances) - return balances - } - - const staking = async (timestamp, _block, chainBlocks) => { - let balances = {}; - const block = chainBlocks[chain] - if (!getPrices) - getPrices = getTokenPrices({ block, chain, lps, coreAssets, allLps: true }) - - const { updateBalances } = await getPrices - - const tao = [] - shares.forEach(token => masonry.forEach(owner => tao.push([token, owner]))) - - await sumTokens(balances, tao, block, chain) - await updateBalances(balances) - return balances - } - - return { - [chain === "avax" ? "avalanche" : chain]: { - tvl: async () => ({}), - staking, - pool2 - } - } - -} - -function pool2({ stakingContract, lpToken, chain = "ethereum", transformAddress, coreAsset }) { - return async (_timestamp, _ethBlock, chainBlocks) => { - const block = chainBlocks[chain] - if (!transformAddress) - transformAddress = await getChainTransform(chain) - - const balances = await sumTokens({}, [[lpToken, stakingContract]], block, chain, transformAddress, { resolveLP: true }) - const { updateBalances } = await getTokenPrices({ block, chain, transformAddress, coreAssets: [coreAsset], lps: [lpToken], allLps: true, }) - - await updateBalances(balances, { resolveLP: false, }) - const fixBalances = await getFixBalances(chain) - fixBalances(balances) - return balances - } -} - -async function sumTokensSingle({ - coreAssets, balances = {}, owner, tokens, chain, block, restrictTokenPrice = false, blacklist = [], skipConversion, onlyLPs, minLPRatio, - log_coreAssetPrices = [], log_minTokenValue = 1e6, -}) { - tokens = getUniqueAddresses(tokens) - blacklist = getUniqueAddresses(blacklist) - const toa = tokens.filter(t => !blacklist.includes(t)).map(i => [i, owner]) - const { updateBalances } = await getTokenPrices({ coreAssets, lps: tokens, chain, block, restrictTokenPrice, blacklist, log_coreAssetPrices, log_minTokenValue, minLPRatio }) - await sumTokens(balances, toa, block, chain) - return updateBalances(balances, { skipConversion, onlyLPs }) -} - -module.exports = { - sumTokensSingle, - getTokenPrices, - getUniTVL, - unknownTombs, - pool2, - getLPData, -}; \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/unwrapLPs.js b/src/adapters/peggedAssets/llama-helper/unwrapLPs.js deleted file mode 100644 index dc910998..00000000 --- a/src/adapters/peggedAssets/llama-helper/unwrapLPs.js +++ /dev/null @@ -1,946 +0,0 @@ -const sdk = require("@defillama/sdk"); -const BigNumber = require("bignumber.js"); -const token0 = require('./abis/token0.json') -const symbol = require('./abis/symbol.json') -const { getPoolTokens, getPoolId } = require('./abis/balancer.json') -const getPricePerShare = require('./abis/getPricePerShare.json') -const { requery } = require('./requery') -const { getChainTransform, getFixBalances } = require('./portedTokens') -const creamAbi = require('./abis/cream.json') -const { unwrapCrv, resolveCrvTokens } = require('./resolveCrvTokens') -const activePoolAbi = require('./ankr/abis/activePool.json') -const wethAddressAbi = require('./ankr/abis/wethAddress.json'); -const { isLP, DEBUG_MODE, getUniqueAddresses, } = require('./utils') -const wildCreditABI = require('../wildcredit/abi.json') - -const yearnVaults = { - // yvToken: underlying, eg yvYFI:YFI - // ycDAI - "0x99d1fa417f94dcd62bfe781a1213c092a47041bc": "0x6b175474e89094c44da98b954eedeac495271d0f", - // ycUSDC - "0x9777d7e2b60bb01759d0e2f8be2095df444cb07e": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", - // ycUSDT - "0x1be5d71f2da660bfdee8012ddc58d024448a0a59": "0xdac17f958d2ee523a2206206994597c13d831ec7", - // yDAI - "0xc2cb1040220768554cf699b0d863a3cd4324ce32": "0x6b175474e89094c44da98b954eedeac495271d0f", - // yUSDT - "0xe6354ed5bc4b393a5aad09f21c46e101e692d447": "0xdac17f958d2ee523a2206206994597c13d831ec7", - // yUSDC - "0xd6ad7a6750a7593e092a9b218d66c0a814a3436e": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", - // yUSDT - "0x83f798e925bcd4017eb265844fddabb448f1707d": "0xdac17f958d2ee523a2206206994597c13d831ec7", - // yvYFI v2 - "0xe14d13d8b3b85af791b2aadd661cdbd5e6097db1": "0x0bc529c00c6401aef6d220be8c6ea1667f6ad93e", - // yvWETH v2 - "0xa258c4606ca8206d8aa700ce2143d7db854d168c": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", - // yvWETH v1 - "0xa9fe4601811213c340e850ea305481aff02f5b28": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", - // yvUSDT v2 - "0x7da96a3891add058ada2e826306d812c638d87a7": "0xdac17f958d2ee523a2206206994597c13d831ec7", - // yvUSDC v2 - "0x5f18c75abdae578b483e5f43f12a39cf75b973a9": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", - // yvUSDC - "0xa354f35829ae975e850e23e9615b11da1b3dc4de": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", - // yvWBTC - "0xa696a63cc78dffa1a63e9e50587c197387ff6c7e": "0x2260fac5e5542a773aa44fbcfedf7c193bc2c599", - // yv1INCH - "0xb8c3b7a2a618c552c23b1e4701109a9e756bab67": "0x111111111117dc0aa78b770fa6a738034120c302", - // yvDAI - "0x19d3364a399d251e894ac732651be8b0e4e85001": "0x6B175474E89094C44Da98b954EedeAC495271d0F", - // yvDAI - "0xacd43e627e64355f1861cec6d3a6688b31a6f952": "0x6B175474E89094C44Da98b954EedeAC495271d0F", - // yvDAI - "0xda816459f1ab5631232fe5e97a05bbbb94970c95": "0x6B175474E89094C44Da98b954EedeAC495271d0F", - // yvDAI - "0x16de59092dae5ccf4a1e6439d611fd0653f0bd01": "0x6B175474E89094C44Da98b954EedeAC495271d0F", - // yvSNX - "0xf29ae508698bdef169b89834f76704c3b205aedf": "0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F", - // yvUNI - "0xfbeb78a723b8087fd2ea7ef1afec93d35e8bed42": "0x1f9840a85d5af5bf1d1762f925bdaddc4201f984", - // yvLINK - "0x671a912c10bba0cfa74cfc2d6fba9ba1ed9530b2": "0x514910771af9ca656af840dff83e8264ecf986ca", - // yvCurve Aave 3pool - "0x39caf13a104ff567f71fd2a4c68c026fdb6e740b": "0xFd2a8fA60Abd58Efe3EeE34dd494cD491dC14900", - // yvcrvSTETH - "0xdcd90c7f6324cfa40d7169ef80b12031770b4325": "0x06325440d014e39736583c165c2963ba99faf14e", - // yvcrvIB - "0x27b7b1ad7288079a66d12350c828d3c00a6f07d7": "0x5282a4ef67d9c33135340fb3289cc1711c13638c", - // yvYFI FTM - "0x2c850cced00ce2b14aa9d658b7cad5df659493db": "0x29b0Da86e484E1C0029B56e817912d778aC0EC69", - // yvDAI FTM - "0x637ec617c86d24e421328e6caea1d92114892439": "0x8D11eC38a3EB5E956B052f67Da8Bdc9bef8Abf3E", - // yvETH FTM - "0xce2fc0bdc18bd6a4d9a725791a3dee33f3a23bb7": "0x74b23882a30290451A17c44f4F05243b6b58C76d", - // yvWBTC FTM - "0xd817a100ab8a29fe3dbd925c2eb489d67f758da9": "0x321162Cd933E2Be498Cd2267a90534A804051b11", - // yvMIM FTM - "0x0a0b23d9786963de69cb2447dc125c49929419d8": "0x82f0b8b456c1a451378467398982d4834b6829c1", - // yvUSDC FTM - "0xef0210eb96c7eb36af8ed1c20306462764935607": "0x04068da6c83afcfa0e13ba15a6696662335d5b75", - // yvWFTM FTM - "0x0dec85e74a92c52b7f708c4b10207d9560cefaf0": "0x21be370d5312f44cb42ce377bc9b8a0cef1a4c83", - // yvUSDT FTM - "0x148c05caf1bb09b5670f00d511718f733c54bc4c": "0x049d68029688eAbF473097a2fC38ef61633A3C7A" -} -async function unwrapYearn(balances, yToken, block, chain = "ethereum", transformAddress = (addr) => addr) { - const underlying = yearnVaults[yToken.toLowerCase()]; - if (!underlying) return; - - const tokenKey = chain == 'ethereum' ? yToken : `${chain}:${yToken}` - if (!balances[tokenKey]) return; - - let pricePerShare - let decimals - try { - pricePerShare = await sdk.api.abi.call({ - target: yToken, - abi: getPricePerShare[1], - block: block, - chain: chain - }); - decimals = (await sdk.api.erc20.decimals(underlying, chain)).output - } catch (e) { - console.log('Failing to get price per share for %s, trying getPricePerFullShare', yToken) - } - if (pricePerShare == undefined) { - pricePerShare = await sdk.api.abi.call({ - target: yToken, - abi: getPricePerShare[0], - block: block, - chain: chain - }); - decimals = 18 - }; - - const newBalance = BigNumber(balances[tokenKey]).times(pricePerShare.output).div(10 ** decimals) - const oldBalance = BigNumber(balances[transformAddress(underlying)] || 0) - balances[transformAddress(underlying)] = oldBalance.plus(newBalance).toFixed(0) - delete balances[tokenKey]; -}; - -const lpReservesAbi = { "constant": true, "inputs": [], "name": "getReserves", "outputs": [{ "internalType": "uint112", "name": "_reserve0", "type": "uint112" }, { "internalType": "uint112", "name": "_reserve1", "type": "uint112" }, { "internalType": "uint32", "name": "_blockTimestampLast", "type": "uint32" }], "payable": false, "stateMutability": "view", "type": "function" } -const lpSuppliesAbi = { "constant": true, "inputs": [], "name": "totalSupply", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "payable": false, "stateMutability": "view", "type": "function" } -const token0Abi = { "constant": true, "inputs": [], "name": "token0", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "payable": false, "stateMutability": "view", "type": "function" } -const token1Abi = { "constant": true, "inputs": [], "name": "token1", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "payable": false, "stateMutability": "view", "type": "function" } - -/* lpPositions:{ - balance, - token -}[] -*/ -async function unwrapUniswapLPs(balances, lpPositions, block, chain = 'ethereum', transformAddress = (addr) => addr, excludeTokensRaw = [], retry = false, uni_type = 'standard',) { - const excludeTokens = excludeTokensRaw.map(addr => addr.toLowerCase()) - const lpTokenCalls = lpPositions.map(lpPosition => ({ - target: lpPosition.token - })) - const lpReserves = sdk.api.abi.multiCall({ - block, - abi: lpReservesAbi, - calls: lpTokenCalls, - chain - }) - const lpSupplies = sdk.api.abi.multiCall({ - block, - abi: lpSuppliesAbi, - calls: lpTokenCalls, - chain - }) - const tokens0 = sdk.api.abi.multiCall({ - block, - abi: token0Abi, - calls: lpTokenCalls, - chain - }) - const tokens1 = sdk.api.abi.multiCall({ - block, - abi: token1Abi, - calls: lpTokenCalls, - chain - }) - if (retry) { - await Promise.all([ - [lpReserves, lpReservesAbi], - [lpSupplies, lpSuppliesAbi], - [tokens0, token0Abi], - [tokens1, token1Abi] - ].map(async call => { - await requery(await call[0], chain, block, call[1]) - })) - } - await Promise.all(lpPositions.map(async lpPosition => { - try { - let token0, token1, supply - const lpToken = lpPosition.token - const token0_ = (await tokens0).output.find(call => call.input.target === lpToken) - const token1_ = (await tokens1).output.find(call => call.input.target === lpToken) - const supply_ = (await lpSupplies).output.find(call => call.input.target === lpToken) - - token0 = token0_.output.toLowerCase() - token1 = token1_.output.toLowerCase() - supply = supply_.output - // console.log(token0_, supply_, token1_, lpToken) - - if (supply === "0") { - return - } - - let _reserve0, _reserve1 - if (uni_type === 'standard') { - ({ _reserve0, _reserve1 } = (await lpReserves).output.find(call => call.input.target === lpToken).output) - } - else if (uni_type === 'gelato') { - const gelatoPools = sdk.api.abi.multiCall({ - block, - abi: gelatoPoolsAbi, - calls: lpTokenCalls, - chain - }); - const gelatoPool = (await gelatoPools).output.find(call => call.input.target === lpToken).output - const [{ output: _reserve0_ }, { output: _reserve1_ }] = (await Promise.all([ - sdk.api.erc20.balanceOf({ - target: token0, - owner: gelatoPool, - block, - chain - }) - , sdk.api.erc20.balanceOf({ - target: token1, - owner: gelatoPool, - block, - chain - }) - ])) - _reserve0 = _reserve0_ - _reserve1 = _reserve1_ - } - - if (!excludeTokens.includes(token0)) { - const token0Balance = BigNumber(lpPosition.balance).times(BigNumber(_reserve0)).div(BigNumber(supply)) - sdk.util.sumSingleBalance(balances, await transformAddress(token0), token0Balance.toFixed(0)) - } - if (!excludeTokens.includes(token1)) { - const token1Balance = BigNumber(lpPosition.balance).times(BigNumber(_reserve1)).div(BigNumber(supply)) - sdk.util.sumSingleBalance(balances, await transformAddress(token1), token1Balance.toFixed(0)) - } - } catch (e) { - if (DEBUG_MODE) console.error(e) - console.log(`Failed to get data for LP token at ${lpPosition.token} on chain ${chain}`) - throw e - } - })) -} - - -// Mostly similar to unwrapGelatoLPs with only edits being gelatoToken0ABI, same for token1 and balances of tokens which are actually held by the contract which address is given by the read pool method -/* lpPositions:{ - balance, - token -}[] -*/ -const gelatoPoolsAbi = { "inputs": [], "name": "pool", "outputs": [{ "internalType": "address", "name": "", "type": "address" }], "stateMutability": "view", "type": "function" } - -async function unwrapGelatoLPs(balances, lpPositions, block, chain = 'ethereum', transformAddress = (addr) => addr, excludeTokensRaw = [], retry = false) { - const excludeTokens = excludeTokensRaw.map(addr => addr.toLowerCase()) - const lpTokenCalls = lpPositions.map(lpPosition => ({ - target: lpPosition.token - })) - const lpReserves = sdk.api.abi.multiCall({ - block, - abi: lpReservesAbi, - calls: lpTokenCalls, - chain - }) - const lpSupplies = sdk.api.abi.multiCall({ - block, - abi: lpSuppliesAbi, - calls: lpTokenCalls, - chain - }) - const tokens0 = sdk.api.abi.multiCall({ - block, - abi: token0Abi, - calls: lpTokenCalls, - chain - }) - const tokens1 = sdk.api.abi.multiCall({ - block, - abi: token1Abi, - calls: lpTokenCalls, - chain - }) - - // Different bit - if (retry) { - await Promise.all([ - [lpReserves, lpReservesAbi], - [lpSupplies, lpSuppliesAbi], - [tokens0, token0Abi], - [tokens1, token1Abi] - ].map(async call => { - await requery(await call[0], chain, block, call[1]) - })) - } - await Promise.all(lpPositions.map(async lpPosition => { - try { - const lpToken = lpPosition.token - const token0 = (await tokens0).output.find(call => call.input.target === lpToken).output.toLowerCase() - const token1 = (await tokens1).output.find(call => call.input.target === lpToken).output.toLowerCase() - const supply = (await lpSupplies).output.find(call => call.input.target === lpToken).output - - // Different bits - const gelatoPool = (await gelatoPools).output.find(call => call.input.target === lpToken).output - const [{ output: _reserve0 }, { output: _reserve1 }] = (await Promise.all([ - sdk.api.erc20.balanceOf({ - target: token0, - owner: gelatoPool, - block, - chain - }) - , sdk.api.erc20.balanceOf({ - target: token1, - owner: gelatoPool, - block, - chain - }) - ])) - - if (!excludeTokens.includes(token0)) { - const token0Balance = BigNumber(lpPosition.balance).times(BigNumber(_reserve0)).div(BigNumber(supply)) - sdk.util.sumSingleBalance(balances, await transformAddress(token0), token0Balance.toFixed(0)) - } - if (!excludeTokens.includes(token1)) { - const token1Balance = BigNumber(lpPosition.balance).times(BigNumber(_reserve1)).div(BigNumber(supply)) - sdk.util.sumSingleBalance(balances, await transformAddress(token1), token1Balance.toFixed(0)) - } - } catch (e) { - console.log(`Failed to get data for LP token at ${lpPosition.token} on chain ${chain}`) - throw e - } - })) -} - -// Unwrap the tokens that are LPs and directly add the others -// To be used when you don't know which tokens are LPs and which are not -async function addTokensAndLPs(balances, tokens, amounts, block, chain = "ethereum", transformAddress = id => id) { - const tokens0 = await sdk.api.abi.multiCall({ - calls: tokens.output.map(t => ({ - target: t.output - })), - abi: token0, - block, - chain - }) - const lpBalances = [] - tokens0.output.forEach((result, idx) => { - const token = tokens.output[idx].output - const balance = amounts.output[idx].output - if (result.success) { - lpBalances.push({ - token, - balance - }) - } else { - sdk.util.sumSingleBalance(balances, transformAddress(token), balance); - } - }) - await unwrapUniswapLPs(balances, lpBalances, block, chain, transformAddress) -} - -/* -tokens [ - [token, isLP] - eg ["0xaaa", true] -] -*/ -async function sumTokensAndLPsSharedOwners(balances, tokens, owners, block, chain = "ethereum", transformAddress = id => id) { - const balanceOfTokens = await sdk.api.abi.multiCall({ - calls: tokens.map(t => owners.map(o => ({ - target: t[0], - params: o - }))).flat(), - abi: 'erc20:balanceOf', - block, - chain - }) - await requery(balanceOfTokens, chain, block, 'erc20:balanceOf') - const isLP = {} - tokens.forEach(token => { - isLP[token[0].toLowerCase()] = token[1] - }) - const lpBalances = [] - balanceOfTokens.output.forEach((result, idx) => { - const token = result.input.target.toLowerCase() - const balance = result.output - if (isLP[token] === true) { - lpBalances.push({ - token, - balance - }) - } else { - sdk.util.sumSingleBalance(balances, transformAddress(token), balance); - } - }) - if (lpBalances.length > 0) { - await unwrapUniswapLPs(balances, lpBalances, block, chain, transformAddress) - } -} - -async function sumTokensSharedOwners(balances, tokens, owners, block, chain = "ethereum", transformAddress) { - if (transformAddress === undefined) { - transformAddress = addr => `${chain}:${addr}` - } - await sumTokensAndLPsSharedOwners(balances, tokens.map(t => [t, false]), owners, block, chain, transformAddress) -} - -async function sumLPWithOnlyOneToken(balances, lpToken, owner, listedToken, block, chain = "ethereum", transformAddress = id => id) { - const [balanceOfLP, balanceOfTokenListedInLP, lpSupply] = await Promise.all([ - sdk.api.erc20.balanceOf({ - target: lpToken, - owner, - block, - chain - }), - sdk.api.erc20.balanceOf({ - target: listedToken, - owner: lpToken, - block, - chain - }), - sdk.api.erc20.totalSupply({ - target: lpToken, - block, - chain - }), - ]) - sdk.util.sumSingleBalance(balances, transformAddress(listedToken), - BigNumber(balanceOfLP.output).times(balanceOfTokenListedInLP.output).div(lpSupply.output).times(2).toFixed(0) - ) -} - -async function sumLPWithOnlyOneTokenOtherThanKnown(balances, lpToken, owner, tokenNotToUse, block, chain = "ethereum", transformAddress = id => id) { - const [token0, token1] = await Promise.all([token0Abi, token1Abi] - .map(abi => sdk.api.abi.call({ - target: lpToken, - abi, - chain, - block - }).then(o => o.output)) - ) - let listedToken = token0 - if (tokenNotToUse.toLowerCase() === listedToken.toLowerCase()) { - listedToken = token1 - } - await sumLPWithOnlyOneToken(balances, lpToken, owner, listedToken, block, chain, transformAddress) -} -async function unwrapUniswapV3NFTs({ balances, nftsAndOwners, block, chain, transformAddress }) { - await Promise.all(nftsAndOwners.map(([nftAddress, owner]) => unwrapUniswapV3NFT({ balances, owner, nftAddress, block, chain, transformAddress }))) - return balances -} - -async function unwrapUniswapV3NFT({ balances, owner, nftAddress, block, chain = 'ethereum', transformAddress }) { - if (!transformAddress) - transformAddress = await getChainTransform(chain) - - const nftPositions = (await sdk.api.erc20.balanceOf({ target: nftAddress, owner, block, chain })).output - const factory = (await sdk.api.abi.call({ target: nftAddress, abi: wildCreditABI.factory, block, chain })).output - - const positionIds = (await sdk.api.abi.multiCall({ - block, chain, abi: wildCreditABI.tokenOfOwnerByIndex, target: nftAddress, - calls: Array(Number(nftPositions)).fill(0).map((_, index) => ({ params: [owner, index] })), - })).output.map(positionIdCall => positionIdCall.output) - - const positions = (await sdk.api.abi.multiCall({ - block, chain, abi: wildCreditABI.positions, target: nftAddress, - calls: positionIds.map((position) => ({ params: [position] })), - })).output.map(positionsCall => positionsCall.output) - - const lpInfo = {} - positions.forEach(position => lpInfo[getKey(position)] = position) - const lpInfoArray = Object.values(lpInfo) - - const poolInfos = (await sdk.api.abi.multiCall({ - block, chain, abi: wildCreditABI.getPool, target: factory, - calls: lpInfoArray.map((info) => ({ params: [info.token0, info.token1, info.fee] })), - })).output.map(positionsCall => positionsCall.output) - - const slot0 = await sdk.api.abi.multiCall({ block, chain, abi: wildCreditABI.slot0, calls: poolInfos.map(i => ({ target: i })) }) - - slot0.output.forEach((slot, i) => lpInfoArray[i].tick = slot.output.tick) - - positions.map(addV3PositionBalances) - return balances - - function getKey(position) { - let { token0, token1, fee } = position - token0 = token0.toLowerCase() - token1 = token1.toLowerCase() - return `${token0}-${token1}-${fee}` - } - - function addV3PositionBalances(position) { - const tickToPrice = (tick) => new BigNumber(1.0001 ** +tick) - - const token0 = position.token0 - const token1 = position.token1 - const liquidity = position.liquidity - const bottomTick = position.tickLower - const topTick = position.tickUpper - const tick = lpInfo[getKey(position)].tick - - let amount0 = BigNumber(0) - let amount1 = BigNumber(0) - - if (Number(tick) < Number(bottomTick)) { - const sa = tickToPrice(new BigNumber(bottomTick).div(2).integerValue(BigNumber.ROUND_DOWN)) - const sb = tickToPrice(new BigNumber(topTick).div(2).integerValue(BigNumber.ROUND_DOWN)) - - amount0 = new BigNumber(liquidity).times(new BigNumber(sb.minus(sa)).div(sa.times(sb))).integerValue(BigNumber.ROUND_DOWN) - } else if (Number(tick) < Number(topTick)) { - const sa = tickToPrice(Math.floor(+bottomTick / 2)) - const sb = tickToPrice(Math.floor(+topTick / 2)) - const price = tickToPrice(tick) - const sp = price.squareRoot() - - amount0 = new BigNumber(liquidity).times(sb.minus(sp)).div(sp.times(sb)).integerValue(BigNumber.ROUND_DOWN) - amount1 = new BigNumber(liquidity).times(sp.minus(sa)).integerValue(BigNumber.ROUND_DOWN) - } else { - const sa = tickToPrice(new BigNumber(bottomTick).div(2)).integerValue(BigNumber.ROUND_DOWN) - const sb = tickToPrice(new BigNumber(topTick).div(2)).integerValue(BigNumber.ROUND_DOWN) - - amount1 = new BigNumber(liquidity).times(new BigNumber(sb.minus(sa))).integerValue(BigNumber.ROUND_DOWN) - } - - sdk.util.sumSingleBalance(balances, transformAddress(token0), amount0.toFixed(0)) - sdk.util.sumSingleBalance(balances, transformAddress(token1), amount1.toFixed(0)) - } -} - -/* -tokens [ - [token, owner, isLP] - eg ["0xaaa", "0xbbb", true] -] -*/ -async function sumTokensAndLPs(balances, tokens, block, chain = "ethereum", transformAddress = id => id) { - const balanceOfTokens = await sdk.api.abi.multiCall({ - calls: tokens.map(t => ({ - target: t[0], - params: t[1] - })), - abi: 'erc20:balanceOf', - block, - chain - }) - const lpBalances = [] - balanceOfTokens.output.forEach((result, idx) => { - const token = result.input.target - const balance = result.output - if (tokens[idx][2]) { - lpBalances.push({ - token, - balance - }) - } else { - sdk.util.sumSingleBalance(balances, transformAddress(token), balance); - } - }) - await unwrapUniswapLPs(balances, lpBalances, block, chain, transformAddress) -} - -const balancerVault = "0xBA12222222228d8Ba445958a75a0704d566BF2C8" -async function sumBalancerLps(balances, tokensAndOwners, block, chain, transformAddress) { - const poolIds = sdk.api.abi.multiCall({ - calls: tokensAndOwners.map(t => ({ - target: t[0] - })), - abi: getPoolId, - block, - chain - }) - const balancerPoolSupplies = sdk.api.abi.multiCall({ - calls: tokensAndOwners.map(t => ({ - target: t[0] - })), - abi: 'erc20:totalSupply', - block, - chain - }) - const balanceOfTokens = sdk.api.abi.multiCall({ - calls: tokensAndOwners.map(t => ({ - target: t[0], - params: t[1] - })), - abi: 'erc20:balanceOf', - block, - chain - }); - const balancerPoolsPromise = sdk.api.abi.multiCall({ - calls: (await poolIds).output.map(o => ({ - target: balancerVault, - params: o.output - })), - abi: getPoolTokens, - block, - chain - }) - const [poolSupplies, tokenBalances, balancerPools] = await Promise.all([balancerPoolSupplies, balanceOfTokens, balancerPoolsPromise]) - tokenBalances.output.forEach((result, idx) => { - const lpBalance = result.output - const balancerPool = balancerPools.output[idx].output - const supply = poolSupplies.output[idx].output - balancerPool.tokens.forEach((token, tokenIndex) => { - const tokensInPool = balancerPool.balances[tokenIndex] - const underlyingBalance = BigNumber(tokensInPool).times(lpBalance).div(supply) - sdk.util.sumSingleBalance(balances, transformAddress(token), underlyingBalance.toFixed(0)); - }) - }) -} - -const nullAddress = '0x0000000000000000000000000000000000000000' -/* -tokensAndOwners [ - [token, owner] - eg ["0xaaa", "0xbbb"] -] -*/ -async function sumTokens(balances = {}, tokensAndOwners, block, chain = "ethereum", transformAddress, { resolveCrv = false, resolveLP = false, resolveYearn = false, unwrapAll = false, blacklistedLPs = [], } = {}) { - if (!transformAddress) - transformAddress = await getChainTransform(chain) - - const ethBalanceInputs = [] - - tokensAndOwners = tokensAndOwners.filter(i => { - if (i[0] !== nullAddress) - return true - ethBalanceInputs.push(i[1]) - return false - }) - - if (ethBalanceInputs.length) { - const { output: ethBalances } = await sdk.api.eth.getBalances({ targets: ethBalanceInputs, chain, block }) - ethBalances.forEach(({ balance }) => sdk.util.sumSingleBalance(balances, transformAddress(nullAddress), balance)) - } - - const balanceOfTokens = await sdk.api.abi.multiCall({ - calls: tokensAndOwners.map(t => ({ - target: t[0], - params: t[1] - })), - abi: 'erc20:balanceOf', - block, - chain - }) - balanceOfTokens.output.forEach((result, idx) => { - const token = transformAddress(result.input.target) - const balance = BigNumber(result.output) - try { - balances[token] = BigNumber(balances[token] || 0).plus(balance).toFixed(0) - } catch (e) { - console.log(token, balance, balances[token]) - throw e - } - }) - - if (resolveLP || unwrapAll) - await unwrapLPsAuto({ balances, block, chain, transformAddress, blacklistedLPs }) - - if (resolveCrv || unwrapAll) - await resolveCrvTokens(balances, block, chain, transformAddress) - - if (resolveYearn || unwrapAll) { - await Promise.all(Object.keys(balances).map(token => unwrapYearn(balances, stripTokenHeader(token), block, chain, transformAddress))) - await resolveCrvTokens(balances, block, chain, transformAddress) - } - - if (['astar', 'harmony'].includes(chain)) { - const fixBalances = await getFixBalances(chain) - fixBalances(balances) - } - - return balances -} - -async function unwrapCreamTokens(balances, tokensAndOwners, block, chain = "ethereum", transformAddress = id => id) { - const [balanceOfTokens, exchangeRates, underlyingTokens] = await Promise.all([ - sdk.api.abi.multiCall({ - calls: tokensAndOwners.map(t => ({ - target: t[0], - params: t[1] - })), - abi: 'erc20:balanceOf', - block, - chain - }), - sdk.api.abi.multiCall({ - calls: tokensAndOwners.map(t => ({ - target: t[0], - })), - abi: creamAbi.exchangeRateStored, - block, - chain - }), - sdk.api.abi.multiCall({ - calls: tokensAndOwners.map(t => ({ - target: t[0], - })), - abi: creamAbi.underlying, - block, - chain - }) - ]) - balanceOfTokens.output.forEach((balanceCall, i) => { - const underlying = underlyingTokens.output[i].output - const balance = BigNumber(balanceCall.output).times(exchangeRates.output[i].output).div(1e18).toFixed(0) - sdk.util.sumSingleBalance(balances, transformAddress(underlying), balance) - }) -} - -const crv_abi = { - "crvLP_coins": { "stateMutability": "view", "type": "function", "name": "coins", "inputs": [{ "name": "arg0", "type": "uint256" }], "outputs": [{ "name": "", "type": "address" }], "gas": 3123 } -} -async function genericUnwrapCrv(balances, crvToken, lpBalance, block, chain) { - const { output: resolvedCrvTotalSupply } = await sdk.api.erc20.totalSupply({ - target: crvToken, - chain, block - }) - - // Get Curve LP token balances - // A while-loop would need a try-catch because sending error when idx > tokens_count - const { output: crv_symbol } = await sdk.api.abi.call({ - abi: 'erc20:symbol', - target: crvToken, - chain, - block - }) - - const LP_tokens_count = ['3Crv'].includes(crv_symbol) ? 3 : 2 - const coins_indices = Array.from(Array(LP_tokens_count).keys()) - const coins = (await sdk.api.abi.multiCall({ - abi: crv_abi['crvLP_coins'], - calls: coins_indices.map(i => ({ params: [i] })), - target: crvToken, - chain, - block - })).output.map(c => c.output) - const crvLP_token_balances = await sdk.api.abi.multiCall({ - abi: 'erc20:balanceOf', - calls: coins.map(c => ({ - target: c, - params: crvToken, - })), - chain, - block - }) - - // Edit the balances to weigh with respect to the wallet holdings of the crv LP token - crvLP_token_balances.output.forEach(call => - call.output = BigNumber(call.output).times(lpBalance).div(resolvedCrvTotalSupply).toFixed(0) - ) - sdk.util.sumMultiBalanceOf(balances, crvLP_token_balances); -} - -const cvx_abi = { - "cvxBRP_pid": { "inputs": [], "name": "pid", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, - "cvxBRP_balanceOf": { "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], "name": "balanceOf", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, - "cvxBRP_earned": { "inputs": [{ "internalType": "address", "name": "account", "type": "address" }], "name": "earned", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, - "cvxBRP_rewards": { "inputs": [{ "internalType": "address", "name": "", "type": "address" }], "name": "rewards", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, - "cvxBRP_userRewardPerTokenPaid": { "inputs": [{ "internalType": "address", "name": "", "type": "address" }], "name": "userRewardPerTokenPaid", "outputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "stateMutability": "view", "type": "function" }, - "cvxBRP_stakingToken": { "inputs": [], "name": "stakingToken", "outputs": [{ "internalType": "address", "name": "stakingToken", "type": "address" }], "stateMutability": "view", "type": "function" }, - "cvxBooster_poolInfo": { "inputs": [{ "internalType": "uint256", "name": "", "type": "uint256" }], "name": "poolInfo", "outputs": [{ "internalType": "address", "name": "lptoken", "type": "address" }, { "internalType": "address", "name": "token", "type": "address" }, { "internalType": "address", "name": "gauge", "type": "address" }, { "internalType": "address", "name": "crvRewards", "type": "address" }, { "internalType": "address", "name": "stash", "type": "address" }, { "internalType": "bool", "name": "shutdown", "type": "bool" }], "stateMutability": "view", "type": "function" } -} -const cvxBoosterAddress = "0xF403C135812408BFbE8713b5A23a04b3D48AAE31"; -async function genericUnwrapCvx(balances, holder, cvx_BaseRewardPool, block, chain) { - // Compute the balance of the treasury of the CVX position and unwrap - const [ - { output: cvx_LP_bal }, - { output: pool_id } - ] = await Promise.all([ - sdk.api.abi.call({ - abi: cvx_abi['cvxBRP_balanceOf'], // cvx_balanceOf cvx_earned cvx_rewards cvx_userRewardPerTokenPaid - target: cvx_BaseRewardPool, - params: [holder], - chain, block - }), - // const {output: pool_id} = await - sdk.api.abi.call({ - abi: cvx_abi['cvxBRP_pid'], - target: cvx_BaseRewardPool, - chain, block - }) - ]) - const { output: crvPoolInfo } = await sdk.api.abi.call({ - abi: cvx_abi['cvxBooster_poolInfo'], - target: cvxBoosterAddress, - params: [pool_id], - chain, - block: block, - }) - await genericUnwrapCrv(balances, crvPoolInfo.lptoken, cvx_LP_bal, block, chain) -} - -async function unwrapLPsAuto({ balances, block, chain = "ethereum", transformAddress, excludePool2 = false, onlyPool2 = false, pool2Tokens = [], blacklistedLPs = [] }) { - if (!transformAddress) - transformAddress = await getChainTransform(chain) - - pool2Tokens = pool2Tokens.map(token => token.toLowerCase()) - blacklistedLPs = blacklistedLPs.map(token => token.toLowerCase()) - const tokens = [] - const amounts = [] - - Object.keys(balances).forEach(key => { - if (chain === 'ethereum' && key.indexOf(':') > -1) return; // token is transformed, probably not an LP - if (chain !== 'ethereum' && !key.startsWith(chain + ':')) return; // token is transformed, probably not an LP - const token = stripTokenHeader(key) - if (!/^0x/.test(token)) return; // if token is not an eth address, we ignore it - tokens.push({ output: token }) - amounts.push({ output: balances[key] }) - delete balances[key] - }) - - return _addTokensAndLPs(balances, tokens, amounts) - - async function _addTokensAndLPs(balances, tokens, amounts) { - const symbols = (await sdk.api.abi.multiCall({ - calls: tokens.map(t => ({ target: t.output })), abi: symbol, block, chain - })).output - const lpBalances = [] - symbols.forEach(({ output }, idx) => { - const token = tokens[idx].output - const balance = amounts[idx].output - if (isLP(output, token, chain) && !blacklistedLPs.includes(token.toLowerCase())) - lpBalances.push({ token, balance }) - else - sdk.util.sumSingleBalance(balances, transformAddress(token), balance); - }) - await _unwrapUniswapLPs(balances, lpBalances) - } - - async function _unwrapUniswapLPs(balances, lpPositions) { - const lpTokenCalls = lpPositions.map(lpPosition => ({ target: lpPosition.token })) - const { output: lpReserves } = await sdk.api.abi.multiCall({ block, abi: lpReservesAbi, calls: lpTokenCalls, chain, }) - const { output: lpSupplies } = await sdk.api.abi.multiCall({ block, abi: lpSuppliesAbi, calls: lpTokenCalls, chain, }) - const { output: tokens0 } = await sdk.api.abi.multiCall({ block, abi: token0Abi, calls: lpTokenCalls, chain, }) - const { output: tokens1 } = await sdk.api.abi.multiCall({ block, abi: token1Abi, calls: lpTokenCalls, chain, }) - - lpPositions.map(lpPosition => { - try { - let token0, token1, supply - const lpToken = lpPosition.token - const token0_ = tokens0.find(call => call.input.target === lpToken) - const token1_ = tokens1.find(call => call.input.target === lpToken) - const supply_ = lpSupplies.find(call => call.input.target === lpToken) - try { - token0 = token0_.output.toLowerCase() - token1 = token1_.output.toLowerCase() - supply = supply_.output - } catch (e) { - console.log('Unable to resolve LP: ', lpToken); - throw e - } - - if (excludePool2) - if (pool2Tokens.includes(token0) || pool2Tokens.includes(token1)) return; - - if (onlyPool2) - if (!pool2Tokens.includes(token0) && !pool2Tokens.includes(token1)) return; - - if (supply === "0") { - return - } - - let _reserve0, _reserve1 - let output = lpReserves.find(call => call.input.target === lpToken); - _reserve0 = output.output._reserve0 || output.output.reserve0 - _reserve1 = output.output._reserve1 || output.output.reserve1 - - const token0Balance = BigNumber(lpPosition.balance).times(BigNumber(_reserve0)).div(BigNumber(supply)).toFixed(0) - const token1Balance = BigNumber(lpPosition.balance).times(BigNumber(_reserve1)).div(BigNumber(supply)).toFixed(0) - sdk.util.sumSingleBalance(balances, transformAddress(token0), token0Balance) - sdk.util.sumSingleBalance(balances, transformAddress(token1), token1Balance) - } catch (e) { - console.log(`Failed to get data for LP token at ${lpPosition.token} on chain ${chain}`) - throw e - } - }) - } -} - -function stripTokenHeader(token) { - return token.indexOf(':') > -1 ? token.split(':')[1] : token -} - -async function unwrapTroves({ balances = {}, chain = 'ethereum', block, troves = [], transformAddress }) { - const troveCalls = troves.map(target => ({ target })) - if (!transformAddress) - transformAddress = await getChainTransform(chain) - const [{ output: activePools }, { output: tokens }] = await Promise.all([ - sdk.api.abi.multiCall({ - block, - abi: activePoolAbi, - calls: troveCalls, - chain - }), - sdk.api.abi.multiCall({ - block, - abi: wethAddressAbi, - calls: troveCalls, - chain - }) - ]) - - const tokensAndOwners = [] - - for (let i = 0; i < troves.length; i++) { - tokensAndOwners.push([tokens[i].output, activePools[i].output]) - } - - await sumTokens(balances, tokensAndOwners, block, chain, transformAddress, { resolveCrv: true, resolveLP: true, resolveYearn: true }) - return balances -} - - -async function sumTokens2({ - balances = {}, - tokensAndOwners = [], - tokens = [], - owners = [], - owner, - block, - chain = 'ethereum', - transformAddress, - resolveCrv = false, - resolveLP = false, - resolveYearn = false, - unwrapAll = false, - blacklistedLPs = [], -}) { - - if (!tokensAndOwners.length) { - tokens = getUniqueAddresses(tokens) - owners = getUniqueAddresses(owners) - if (owner) tokensAndOwners = tokens.map(t => [t, owner]) - if (owners.length) tokensAndOwners = tokens.map(t => owners.map(o => [t, o])).flat() - } - - return sumTokens(balances, tokensAndOwners, block, chain, transformAddress, { resolveCrv, resolveLP, resolveYearn, unwrapAll, blacklistedLPs }) -} - -module.exports = { - unwrapYearn, - unwrapCrv, - unwrapUniswapLPs, - unwrapUniswapV3NFTs, - addTokensAndLPs, - sumTokensAndLPsSharedOwners, - sumTokensAndLPs, - sumTokens, - sumBalancerLps, - unwrapCreamTokens, - sumLPWithOnlyOneToken, - sumTokensSharedOwners, - sumLPWithOnlyOneTokenOtherThanKnown, - unwrapGelatoLPs, - genericUnwrapCrv, - genericUnwrapCvx, - unwrapLPsAuto, - unwrapTroves, - isLP, - sumTokens2, -} diff --git a/src/adapters/peggedAssets/llama-helper/utils.js b/src/adapters/peggedAssets/llama-helper/utils.js deleted file mode 100644 index a07cd58a..00000000 --- a/src/adapters/peggedAssets/llama-helper/utils.js +++ /dev/null @@ -1,180 +0,0 @@ -const BigNumber = require("bignumber.js"); -const retry = require('async-retry') -const axios = require("axios"); -const sdk = require('@defillama/sdk') -const http = require('./http') - -async function returnBalance(token, address, block, chain) { - const { output: decimals } = await sdk.api.erc20.decimals(token, chain) - let { output: balance } = await sdk.api.erc20.balanceOf({ target: token, owner: address, chain, block }) - balance = await new BigNumber(balance).div(10 ** decimals).toFixed(2); - return parseFloat(balance); -} - -async function returnEthBalance(address) { - const output = await sdk.api.eth.getBalance({ target: address }) - let ethAmount = await new BigNumber(output.output).div(10 ** 18).toFixed(2); - return parseFloat(ethAmount); -} - -async function getPrices(object) { - var stringFetch = ''; - for (var key in object[0]) { - if (object[0][key] != 'stable') { - if (stringFetch.length > 0) { - stringFetch = stringFetch + ',' + object[0][key]; - } else { - stringFetch = object[0][key]; - } - } - } - return fetchURL(`https://api.coingecko.com/api/v3/simple/price?ids=${stringFetch}&vs_currencies=usd&include_market_cap=true&include_24hr_vol=true&include_24hr_change=true`) -} - -async function getPricesFromContract(object) { - var contractFetch = '' - for (var key in object) { - if (object[key]) { - if (contractFetch.length > 0) { - contractFetch = contractFetch + ',' + object[key]; - } else { - contractFetch = object[key]; - } - } - } - return fetchURL(`https://api.coingecko.com/api/v3/simple/token_price/ethereum?contract_addresses=${contractFetch}&vs_currencies=usd&include_market_cap=true&include_24hr_vol=true&include_24hr_change=true`) -} - -async function getPricesfromString(stringFeed) { - return fetchURL(`https://api.coingecko.com/api/v3/simple/price?ids=${stringFeed}&vs_currencies=usd&include_market_cap=true&include_24hr_vol=true&include_24hr_change=true`) -} - - -async function fetchURL(url) { - return retry(async bail => await axios.get(url), { - retries: 3 - }) -} - -async function postURL(url, data) { - return retry(async bail => await axios.post(url, data), { - retries: 3 - }) -} - -function createIncrementArray(length) { - const arr = [] - for (let i = 0; i < length; i++) - arr.push(i) - - return arr -} - -const LP_SYMBOLS = ['SLP', 'spLP', 'JLP', 'OLP', 'SCLP', 'DLP', 'MLP', 'MSLP', 'ULP', 'TLP', 'HMDX', 'YLP', 'SCNRLP', 'PGL', 'GREEN-V2', 'PNDA-V2', 'vTAROT', 'TETHYSLP', 'BAO-V2', 'DINO-V2', 'DFYNLP', 'LavaSwap', 'RLP'] -const blacklisted_LPS = [ - '0xb3dc4accfe37bd8b3c2744e9e687d252c9661bc7', - '0xf146190e4d3a2b9abe8e16636118805c628b94fe', -].map(i => i.toLowerCase()) - -function isLP(symbol, token, chain) { - if (token && blacklisted_LPS.includes(token.toLowerCase())) return false - if (chain === 'bsc' && ['OLP', 'DLP', 'MLP', 'LP'].includes(symbol)) return false - if (chain === 'metis' && ['NLP'].includes(symbol)) return true // Netswap LP Token - if (!symbol) return false - let label - - if (symbol.startsWith('ZLK-LP') || symbol.includes('DMM-LP') || (chain === 'avax' && 'DLP' === symbol)) - label = 'Blackisting this LP because of unsupported abi' - - if (label) { - if (DEBUG_MODE) console.log(label, token, symbol) - return false - } - - return LP_SYMBOLS.includes(symbol) || /(UNI-V2)/.test(symbol) || symbol.split(/\W+/).includes('LP') -} - -function mergeExports(...exportsArray) { - exportsArray = exportsArray.flat() - const exports = {} - - exportsArray.forEach(exportObj => { - Object.keys(exportObj).forEach(key => { - if (typeof exportObj[key] !== 'object') { - exports[key] = exportObj[key] - return; - } - Object.keys(exportObj[key]).forEach(key1 => addToExports(key, key1, exportObj[key][key1])) - }) - }) - - Object.keys(exports) - .filter(chain => typeof exports[chain] === 'object') - .forEach(chain => { - const obj = exports[chain] - Object.keys(obj).forEach(key => { - if (obj[key].length > 1) - obj[key] = sdk.util.sumChainTvls(obj[key]) - else - obj[key] = obj[key][0] - }) - }) - - - return exports - - function addToExports(chain, key, fn) { - if (!exports[chain]) exports[chain] = {} - if (!exports[chain][key]) exports[chain][key] = [] - exports[chain][key].push(fn) - } -} - -async function getBalance(chain, account) { - switch (chain) { - case 'bitcoin': - return (await http.get(`https://chain.api.btc.com/v3/address/${account}`)).data.balance / 1e8 - default: throw new Error('Unsupported chain') - } -} - -function getUniqueAddresses(addresses) { - const set = new Set() - addresses.forEach(i => set.add(i.toLowerCase())) - return [...set] -} - -const DEBUG_MODE = !!process.env.LLAMA_DEBUG_MODE - -function log(...args) { - if (DEBUG_MODE) { - console.log(...args); - } -} - -function sliceIntoChunks(arr, chunkSize = 100) { - const res = []; - for (let i = 0; i < arr.length; i += chunkSize) { - const chunk = arr.slice(i, i + chunkSize); - res.push(chunk); - } - return res; -} - -module.exports = { - DEBUG_MODE, - log, - createIncrementArray, - fetchURL, - postURL, - getPricesfromString, - getPrices, - returnBalance, - returnEthBalance, - getPricesFromContract, - isLP, - mergeExports, - getBalance, - getUniqueAddresses, - sliceIntoChunks, -} diff --git a/src/adapters/peggedAssets/llama-helper/utils/enigma.js b/src/adapters/peggedAssets/llama-helper/utils/enigma.js deleted file mode 100644 index 68e098f1..00000000 --- a/src/adapters/peggedAssets/llama-helper/utils/enigma.js +++ /dev/null @@ -1,118 +0,0 @@ - -const miscreant = require("miscreant"); -const curve25519 = require("curve25519-js"); -const { get } = require('../http') - -// const crypto = require('node:crypto') // -- can be used for node v16 and above -// const hkdf = require("js-crypto-hkdf") // -- needed for node v14 and below -const toBase64 = str => Buffer.from(str).toString('base64') -const fromBase64 = str => Buffer.from(str, 'base64') - - -const cryptoProvider = new miscreant.PolyfillCryptoProvider(); -const hkdfSalt = Uint8Array.from([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x4b, 0xea, 0xd8, 0xdf, 0x69, 0x99, 0x08, 0x52, 0xc2, 0x02, 0xdb, 0x0e, 0x00, 0x97, 0xc1, 0xa1, 0x2e, 0xa6, 0x37, 0xd7, 0xe9, 0x6d,]); - -class EnigmaUtils { - constructor(apiUrl) { - this.consensusIoPubKey = null; // cache - this.apiUrl = apiUrl; - this.seed = EnigmaUtils.GenerateNewSeed(); - const { privkey, pubkey } = EnigmaUtils.GenerateNewKeyPairFromSeed(this.seed); - this.privkey = privkey; - this.pubkey = pubkey; - } - static GenerateNewKeyPair() { - return EnigmaUtils.GenerateNewKeyPairFromSeed(EnigmaUtils.GenerateNewSeed()); - } - static GenerateNewSeed() { - return new Uint8Array(Buffer.alloc(32, 0)) // We dont care about true random - } - static GenerateNewKeyPairFromSeed(seed) { - const { private: privkey, public: pubkey } = curve25519.generateKeyPair(seed); - return { privkey, pubkey }; - } - async getConsensusIoPubKey() { - if (this.consensusIoPubKey) return this.consensusIoPubKey - if (!this.getKey) { - this.getKey = get(this.apiUrl + "/reg/tx-key") - } - - const { result: { TxKey }, } = await this.getKey - this.consensusIoPubKey = fromBase64(TxKey); - return this.consensusIoPubKey; - } - async getTxEncryptionKey(nonce) { - // const consensusIoPubKey = await this.getConsensusIoPubKey(); - // const txEncryptionIkm = curve25519.sharedKey(this.privkey, consensusIoPubKey); - // const txEncryptionKey = crypto.hkdfSync("sha256", Uint8Array.from([...txEncryptionIkm, ...nonce]), hkdfSalt, '', 32) - // const { key: txEncryptionKey } = await hkdf.compute(Uint8Array.from([...txEncryptionIkm, ...nonce]), "SHA-256", 32, "", hkdfSalt) - const txEncryptionKey = fakeKey - return new Uint8Array(txEncryptionKey) - } - async encrypt(contractCodeHash, msg) { - const nonce = new Uint8Array(Buffer.alloc(32, 0)) // We dont care about true random - const txEncryptionKey = await this.getTxEncryptionKey(nonce); - const siv = await miscreant.SIV.importKey(txEncryptionKey, "AES-SIV", cryptoProvider); - const plaintext = toUtf8(contractCodeHash + JSON.stringify(msg)); - const ciphertext = await siv.seal(plaintext, [new Uint8Array()]); - // ciphertext = nonce(32) || wallet_pubkey(32) || ciphertext - return Uint8Array.from([...nonce, ...this.pubkey, ...ciphertext]); - } - async decrypt(ciphertext, nonce) { - var _a; - if (!((_a = ciphertext) === null || _a === void 0 ? void 0 : _a.length)) { - return new Uint8Array(); - } - const txEncryptionKey = await this.getTxEncryptionKey(nonce); - //console.log(`decrypt tx encryption key: ${Encoding.toHex(txEncryptionKey)}`); - const siv = await miscreant.SIV.importKey(txEncryptionKey, "AES-SIV", cryptoProvider); - const plaintext = await siv.open(ciphertext, [new Uint8Array()]); - return plaintext; - } - getPubkey() { - return Promise.resolve(this.pubkey); - } -} - -function toUtf8(str) { - return new TextEncoder().encode(str); -} - -function fromUtf8(data) { - return new TextDecoder("utf-8", { fatal: true }).decode(data); -} - -function toHex(data) { - let out = ""; - for (const byte of data) { - out += ("0" + byte.toString(16)).slice(-2); - } - return out; -} - -function fromHex(hexstring) { - if (hexstring.length % 2 !== 0) { - throw new Error("hex string length must be a multiple of 2"); - } - const out = new Uint8Array(hexstring.length / 2); - for (let i = 0; i < out.length; i++) { - const j = 2 * i; - const hexByteAsString = hexstring.slice(j, j + 2); - if (!hexByteAsString.match(/[0-9a-f]{2}/i)) { - throw new Error("hex string contains invalid characters"); - } - out[i] = parseInt(hexByteAsString, 16); - } - return out; -} - -EnigmaUtils.fromHex = fromHex -EnigmaUtils.toHex = toHex -EnigmaUtils.toUtf8 = toUtf8 -EnigmaUtils.fromUtf8 = fromUtf8 -EnigmaUtils.fromBase64 = fromBase64 -EnigmaUtils.toBase64 = toBase64 - -module.exports = EnigmaUtils - -const fakeKey = new Uint8Array([104, 52, 184, 163, 49, 137, 219, 71, 54, 99, 223, 160, 48, 83, 58, 92, 175, 118, 60, 103, 134, 11, 44, 191, 210, 206, 164, 120, 48, 100, 9, 130]).buffer \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/utils/pact.js b/src/adapters/peggedAssets/llama-helper/utils/pact.js deleted file mode 100644 index b924b382..00000000 --- a/src/adapters/peggedAssets/llama-helper/utils/pact.js +++ /dev/null @@ -1,123 +0,0 @@ -const blake = require("blakejs") - -function prepareExecCmd(pactCode, meta = mkMeta("", "", 0, 0, 0, 0), networkId) { - const cmdJSON = { - networkId, - payload: { - exec: { - data: {}, - code: pactCode - } - }, - signers: [], - meta, - nonce: JSON.stringify(new Date().toISOString()) - }; - const cmd = JSON.stringify(cmdJSON); - const sigs = attachSig(cmd); - return mkSingleCmd(sigs, cmd); -} - -/** - * Makes a single command given signed data. - * @param sigs {array} - array of signature objects, see 'sign' - * @param cmd {string} - stringified JSON blob used to create hash - * @return valid Pact API command for send or local use. - */ -function mkSingleCmd(sigs, cmd) { - return { - hash: sigs[0].hash, - sigs: [], - cmd - }; -} - -function attachSig(msg) { - var hshBin = hashBin(msg); - var hsh = b64urlEncodeArr(hshBin); - return [{ hash: hsh, sig: undefined }] -} - - -/** - * Perform blake2b256 hashing. - */ -function hashBin(s) { - return blake.blake2b(s, null, 32); -} - -function b64urlEncodeArr(input) { - return b64url.encode(uint8ArrayToStr(input)); -} - -function uint8ArrayToStr(a) { - return String.fromCharCode.apply(null, new Uint16Array(a)); -} - -const b64url = (function () { - - 'use strict'; - - var chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_='; - - function InvalidCharacterError(message) { - this.message = message; - } - InvalidCharacterError.prototype = new Error(); - InvalidCharacterError.prototype.name = 'InvalidCharacterError'; - - // encoder - // [https://gist.github.com/999166] by [https://github.com/nignag] - function base64UrlEncode(input) { - var str = String(input); - for ( - // initialize result and counter - var block, charCode, idx = 0, map = chars, output = ''; - // if the next str index does not exist: - // change the mapping table to "=" - // check if d has no fractional digits - // str.charAt (idx | 0) || (map = '=', idx % 1); - str.charAt(idx | 0); - // "8 - idx % 1 * 8" generates the sequence 2, 4, 6, 8 - output += map.charAt(63 & block >> 8 - idx % 1 * 8) - ) { - charCode = str.charCodeAt(idx += 3 / 4); - if (charCode > 0xFF) { - throw new InvalidCharacterError("'btoa' failed: The string to be encoded contains characters outside of the Latin1 range."); - } - block = block << 8 | charCode; - } - return output; - } - - // decoder - // [https://gist.github.com/1020396] by [https://github.com/atk] - function base64UrlDecode(input) { - var str = (String(input)).replace(/[=]+$/, ''); // #31: ExtendScript bad parse of /= - if (str.length % 4 === 1) { - throw new InvalidCharacterError("'atob' failed: The string to be decoded is not correctly encoded."); - } - for ( - // initialize result and counters - var bc = 0, bs, buffer, idx = 0, output = ''; - // get next character - buffer = str.charAt(idx++); // eslint-disable-line no-cond-assign - // character found in table? initialize bit storage and add its ascii value; - ~buffer && (bs = bc % 4 ? bs * 64 + buffer : buffer, - // and if not first of each 4 characters, - // convert the first 8 bits to one ascii character - bc++ % 4) ? output += String.fromCharCode(255 & bs >> (-2 * bc & 6)) : 0 - ) { - // try to find character in table (0-63, not found => -1) - buffer = chars.indexOf(buffer); - } - return output; - } - - return { encode: base64UrlEncode, decode: base64UrlDecode }; - -})() - -module.exports = { - prepareExecCmd -} \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/wavesAdapter.js b/src/adapters/peggedAssets/llama-helper/wavesAdapter.js deleted file mode 100644 index 8b5e8e78..00000000 --- a/src/adapters/peggedAssets/llama-helper/wavesAdapter.js +++ /dev/null @@ -1,24 +0,0 @@ -const {getApiTvl} = require('../helper/historicalApi') -const {fetchURL} = require('../helper/utils') - -const MINUTE = 60*1000 - -function wavesAdapter(endpoint, calcTvl){ - return async (time) => { - return getApiTvl(time, async()=>{ - const data = (await fetchURL(`${endpoint}?limit=1000&since=${time*1e3-10*MINUTE}`)).data - const last = data[data.length-1] - return calcTvl(last) - }, async()=>{ - const data = (await fetchURL(`${endpoint}?limit=1000&since=${time*1e3-6*60*MINUTE}`)).data - return data.map(item=>({ - date: item.createdAt/1e3, - totalLiquidityUSD: calcTvl(item) - })) - }) - } -} - -module.exports={ - wavesAdapter -} \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/whitelistedExportKeys.json b/src/adapters/peggedAssets/llama-helper/whitelistedExportKeys.json deleted file mode 100644 index 31fe90c6..00000000 --- a/src/adapters/peggedAssets/llama-helper/whitelistedExportKeys.json +++ /dev/null @@ -1,19 +0,0 @@ -[ - "tvl", - "staking", - "methodology", - "pool2", - "misrepresentedTokens", - "fetch", - "timetravel", - "borrowed", - "start", - "masterchef", - "doublecounted", - "treasury", - "hallmarks", - "incentivized", - "offers", - "deadFrom", - "broken" -] \ No newline at end of file diff --git a/src/adapters/peggedAssets/llama-helper/zilliqa.js b/src/adapters/peggedAssets/llama-helper/zilliqa.js deleted file mode 100644 index b7bf4b75..00000000 --- a/src/adapters/peggedAssets/llama-helper/zilliqa.js +++ /dev/null @@ -1,278 +0,0 @@ -const retry = require('../helper/retry') -const axios = require('axios') -const BigNumber = require('bignumber.js') - -const ZILLIQA_API = 'https://api.zilliqa.com/' // Mainnet API - -async function call(query) { - return retry(async () => await axios.post(ZILLIQA_API, query)) -} - -function formQuery(args) { - if (Array.isArray(args)) return args.map(formQuery) - - let { - id, - jsonrpc = '2.0', - method = 'GetSmartContractSubState', - params - } = args - - if (!id) id = `${params[1]}-${params[0]}` - - return { id, jsonrpc, method, params, } -} - -async function getContractState(contract, method, args = []) { - if (contract.startsWith('0x')) contract = contract.slice(2) - return call({ - params: [contract, method, ...args] - }) -} - -async function getBalance(token, address) { - if (token.startsWith('0x')) token = token.slice(2) - const { - data: { - result: { - balances - } - } - } = await call(formQuery({ - params: [ - token, - 'balances', - [address] - ] - })) - return balances[address] -} - -async function getZilliqaBalance(address) { - if (address.startsWith('0x')) address = address.slice(2) - const { - data: { - result: { - balance - } - } - } = await call(formQuery({ method: 'GetBalance', params: [address] })) - return BigNumber(balance).shiftedBy(-1 * 12) -} - -async function getBalances(tokens, addresses, balances = {}) { - if (!Array.isArray(tokens)) tokens = [tokens] - if (!Array.isArray(addresses)) addresses = [addresses] - - const query = tokens - .map(token => - addresses.map(addr => formQuery({ - id: `${token}-${addr}`, - params: [ - token.startsWith('0x') ? token.slice(2) : token, - 'balances', - [addr] - ] - }) - )).flat() - - const { - data - } = await call(query) - - data.forEach((response) => { - const { id, result } = response - if (!result) return - let token = id.split('-')[0] - const tokenRef = TOKENS[token] - let decimals = 0 - - if (tokenRef && tokenRef.decimals) - decimals = tokenRef.decimals - - if (tokenRef && tokenRef.coingeckoId) - token = tokenRef.coingeckoId - else - token = `zilliqa:${token}` - - if (!balances[token]) - balances[token] = BigNumber(0) - - const balancesSum = Object.values(result.balances) - .reduce((sum, i) => sum.plus(BigNumber(i).shiftedBy(decimals * -1)), BigNumber(0)) - - balances[token] = balances[token].plus(balancesSum) - }) - - return balances -} - -// taken from https://swap.xcadnetwork.com/_next/data/E6YkkwWJMYjzQhGDTm38j/pool-overview.json -const TOKENS = { - '0x153feaddc48871108e286de3304b9597c817b456': { - name: 'XCAD Token', - symbol: 'XCAD', - decimals: 18, - contractAddress: '0x153feaddc48871108e286de3304b9597c817b456', - coingeckoId: 'xcad-network' - }, - '0x327082dd216ff625748b13e156b9d1a5d3dd41f2': { - name: 'dXCAD Token', - symbol: 'dXCAD', - decimals: 18, - contractAddress: '0x327082dd216ff625748b13e156b9d1a5d3dd41f2' - }, - '0x818ca2e217e060ad17b7bd0124a483a1f66930a9': { - name: 'Zilliqa-bridged USDT token', - symbol: 'zUSDT', - decimals: 6, - contractAddress: '0x818ca2e217e060ad17b7bd0124a483a1f66930a9', - coingeckoId: 'tether' - }, - '0x201C44B426D85fB2c382563483140825Fd81b9b5': { - name: 'Opulous', - symbol: 'zOPUL', - decimals: 18, - contractAddress: '0x201C44B426D85fB2c382563483140825Fd81b9b5', - coingeckoId: 'opulous' - }, - '0x31bFa2054B7199F936733f9054DBCE259a3c335a': { - name: 'Lunr Token', - symbol: 'Lunr', - decimals: 4, - contractAddress: '0x31bFa2054B7199F936733f9054DBCE259a3c335a', - coingeckoId: 'lunr-token', - }, - '0x9945a0da3dc74e364da4ea96946c99336013eeb5': { - name: 'Heroes Of Lowhelm', - symbol: 'HOL', - decimals: 5, - contractAddress: '0x9945a0da3dc74e364da4ea96946c99336013eeb5' - }, - '0xbf79e16872fad92c16810ddd2a7b9b6858c7b756': { - name: 'CARBON Token', - symbol: 'CARB', - decimals: 8, - contractAddress: '0xbf79e16872fad92c16810ddd2a7b9b6858c7b756', - coingeckoId: 'carbon-labs' - }, - '0x3a683fdc022b26d755c70e9ed7cfcc446658018b': { - name: 'PackagePortal Token', - symbol: 'PORT', - decimals: 4, - contractAddress: '0x3a683fdc022b26d755c70e9ed7cfcc446658018b', - coingeckoId: 'packageportal', - }, - '0x91228A48AEA4E4071B9C6444Eb08B021399CfF7c': { - name: 'Unifees Token', - symbol: 'FEES', - decimals: 4, - contractAddress: '0x91228A48AEA4E4071B9C6444Eb08B021399CfF7c', - coingeckoId: 'unifees' - }, - '0xa3eAFd5021F6B9c36fD02Ed58aa1d015F2238791': { - name: 'ZILStream Token', - symbol: 'STREAM', - decimals: 8, - contractAddress: '0xa3eAFd5021F6B9c36fD02Ed58aa1d015F2238791', - coingeckoId: 'zilstream' - }, - '0xa845C1034CD077bD8D32be0447239c7E4be6cb21': { - name: 'Governance ZIL', - symbol: 'gZIL', - decimals: 15, - contractAddress: '0xa845C1034CD077bD8D32be0447239c7E4be6cb21', - coingeckoId: 'governance-zil' - }, - '0xb393C898b3d261C362a4987CaE5a833232AA666E': { - name: 'Score', - symbol: 'SCO', - decimals: 4, - contractAddress: '0xb393C898b3d261C362a4987CaE5a833232AA666E', - coingeckoId: 'score-token', - }, - '0x173Ca6770Aa56EB00511Dac8e6E13B3D7f16a5a5': { - name: 'XSGD', - symbol: 'XSGD', - decimals: 6, - contractAddress: '0x173Ca6770Aa56EB00511Dac8e6E13B3D7f16a5a5', - coingeckoId: 'xsgd', - }, - '0xaCb721d989c095c64A24d16DfD23b08D738e2552': { - name: 'REDChillies Token', - symbol: 'REDC', - decimals: 9, - contractAddress: '0xaCb721d989c095c64A24d16DfD23b08D738e2552', - coingeckoId: 'redchillies', - }, - '0x75fA7D8BA6BEd4a68774c758A5e43Cfb6633D9d6': { - name: 'Wrapped Bitcoin', - symbol: 'zWBTC', - decimals: 8, - contractAddress: '0x75fA7D8BA6BEd4a68774c758A5e43Cfb6633D9d6', - coingeckoId: 'bitcoin', - }, - '0x2cA315F4329654614d1E8321f9C252921192c5f2': { - name: 'Ethereum', - symbol: 'zETH', - decimals: 18, - contractAddress: '0x2cA315F4329654614d1E8321f9C252921192c5f2', - coingeckoId: 'ethereum' - }, - '0x4268C34dA6Ad41a4cDeAa25cdEF6531Ed0c9a1A2': { - name: 'BLOX', - symbol: 'BLOX', - decimals: 2, - contractAddress: '0x4268C34dA6Ad41a4cDeAa25cdEF6531Ed0c9a1A2', - coingeckoId: 'blox-token' - }, - '0x2fc7167c3Baff89E2805Aef72636ccD98eE6Bbb2': { - name: 'DeMons', - symbol: 'DMZ', - decimals: 18, - contractAddress: '0x2fc7167c3Baff89E2805Aef72636ccD98eE6Bbb2' - }, - '0x32339fa037f7ae1DfFF25e13c6451a80289D61F4': { - name: 'Brokoli', - symbol: 'zBRKL', - decimals: 18, - contractAddress: '0x32339fa037f7ae1DfFF25e13c6451a80289D61F4', - coingeckoId: 'brokoli', - }, - '0xC6Bb661eDA683BdC792b3e456A206a92cc3cB92e': { - name: 'DUCKDUCK', - symbol: 'DUCK', - decimals: 2, - contractAddress: '0xC6Bb661eDA683BdC792b3e456A206a92cc3cB92e', - coingeckoId: 'duckduck-token', - }, - '0x9bd504b1445fdb8f4a643453ec1459bb9a2f988a': { - name: 'XIDR', - symbol: 'XIDR', - decimals: 6, - contractAddress: '0x9bd504b1445fdb8f4a643453ec1459bb9a2f988a' - }, - '0x54aE64e2092749fb8d25470ffc1d4D6A19c6f2Ab': { - name: 'Okipad', - symbol: 'Oki', - decimals: 5, - contractAddress: '0x54aE64e2092749fb8d25470ffc1d4D6A19c6f2Ab' - }, - '0x083196549637fAf95C91EcCD157E60430e69E1A7': { - name: 'Sparda Wallet', - symbol: 'SPW', - decimals: 4, - contractAddress: '0x083196549637fAf95C91EcCD157E60430e69E1A7', - coingeckoId: 'sparda-wallet', - } -} - - -module.exports = { - call, - formQuery, - getContractState, - getBalance, - getZilliqaBalance, - getBalances, -} \ No newline at end of file diff --git a/src/adapters/peggedAssets/mimatic/index.ts b/src/adapters/peggedAssets/mimatic/index.ts index 07776f63..20cd6f32 100644 --- a/src/adapters/peggedAssets/mimatic/index.ts +++ b/src/adapters/peggedAssets/mimatic/index.ts @@ -1,7 +1,6 @@ const sdk = require("@defillama/sdk"); import { sumSingleBalance } from "../helper/generalUtil"; -import { getTokenBalance as solanaGetTokenBalance } from "../helper/solana"; -import { getTokenSupply as solanaGetTokenSupply } from "../llama-helper/solana"; +import { getTokenBalance as solanaGetTokenBalance, getTokenSupply as solanaGetTokenSupply } from "../helper/solana"; import { ChainBlocks, PeggedIssuanceAdapter, @@ -349,7 +348,7 @@ const adapter: PeggedIssuanceAdapter = { fantom: { none: maiApiCirculating("fantomSupply"), }, - avalanche: { + avax: { none: maiApiCirculating("avalancheSupply"), }, moonriver: { @@ -463,7 +462,7 @@ const adapter: PeggedIssuanceAdapter = { chainContracts.solana.reserveAddress[0] ), }, - avalanche: { + avax: { polygon: bridgedMAISupply( "avax", 18, diff --git a/src/adapters/peggedAssets/nostra-uno/index.ts b/src/adapters/peggedAssets/nostra-uno/index.ts index 26d8caa4..bee06d36 100644 --- a/src/adapters/peggedAssets/nostra-uno/index.ts +++ b/src/adapters/peggedAssets/nostra-uno/index.ts @@ -1,5 +1,5 @@ const sdk = require("@defillama/sdk"); -import { call } from "../llama-helper/starknet"; +import { call } from "../helper/starknet"; import { sumSingleBalance } from "../helper/generalUtil"; import { Balances, diff --git a/src/adapters/peggedAssets/ratio-stable-coin/index.ts b/src/adapters/peggedAssets/ratio-stable-coin/index.ts index 735599b9..55f56ed1 100644 --- a/src/adapters/peggedAssets/ratio-stable-coin/index.ts +++ b/src/adapters/peggedAssets/ratio-stable-coin/index.ts @@ -1,6 +1,6 @@ const sdk = require("@defillama/sdk"); import { PeggedIssuanceAdapter } from "../peggedAsset.type"; -import { endpoint } from "../llama-helper/solana"; +import { endpoint } from "../helper/solana"; const { Connection, PublicKey } = require("@solana/web3.js"); const { Program, Provider, web3, utils } = require("@project-serum/anchor"); const { NodeWallet } = require("@project-serum/anchor/dist/cjs/provider"); diff --git a/src/adapters/peggedAssets/stbl/index.ts b/src/adapters/peggedAssets/stbl/index.ts index 18d9f8e8..72954c11 100644 --- a/src/adapters/peggedAssets/stbl/index.ts +++ b/src/adapters/peggedAssets/stbl/index.ts @@ -1,12 +1,10 @@ -const sdk = require("@defillama/sdk"); import { sumSingleBalance } from "../helper/generalUtil"; -import { bridgedSupply } from "../helper/getSupply"; import { ChainBlocks, PeggedIssuanceAdapter, - Balances, ChainContracts, + Balances, } from "../peggedAsset.type"; -const { lookupApplications } = require("../llama-helper/algorand"); +const { lookupApplications } = require("../helper/algorand"); const axios = require("axios"); const retry = require("async-retry"); diff --git a/src/adapters/peggedAssets/test.ts b/src/adapters/peggedAssets/test.ts index 3b25d47f..257db589 100644 --- a/src/adapters/peggedAssets/test.ts +++ b/src/adapters/peggedAssets/test.ts @@ -176,14 +176,7 @@ const INTERNAL_CACHE_FILE = 'pegged-assets-cache/sdk-cache.json'; if (!chains.includes("ethereum")) { chains.push("ethereum"); } - /* await Promise.all( - chains.map(async (chainRaw) => { - const chain = chainRaw === "avalanche" ? "avax" : chainRaw; - if (chainsForBlocks.includes(chain) || chain === "ethereum") { - chainBlocks[chain] = (await getLatestBlockRetry(chain)).number - 10; - } - }) - ); */ + const ethBlock = chainBlocks.ethereum; let pegType = process.argv[3]; diff --git a/src/adapters/peggedAssets/tether/index.ts b/src/adapters/peggedAssets/tether/index.ts index c188cf27..f9a0a5ae 100644 --- a/src/adapters/peggedAssets/tether/index.ts +++ b/src/adapters/peggedAssets/tether/index.ts @@ -16,7 +16,7 @@ import { import { getTotalSupply as kavaGetTotalSupply } from "../helper/kava"; import { getTotalBridged as pnGetTotalBridged } from "../helper/polynetwork"; import { getTotalSupply as aptosGetTotalSupply } from "../helper/aptos"; -import { call as nearCall } from "../llama-helper/near"; +import { call as nearCall } from "../helper/near"; import { ChainBlocks, PeggedIssuanceAdapter, diff --git a/src/adapters/peggedAssets/true-usd/index.ts b/src/adapters/peggedAssets/true-usd/index.ts index 3d4faf5e..70616363 100644 --- a/src/adapters/peggedAssets/true-usd/index.ts +++ b/src/adapters/peggedAssets/true-usd/index.ts @@ -9,7 +9,7 @@ import { import { getTotalSupply as tronGetTotalSupply, // NOTE THIS DEPENDENCY } from "../helper/tron"; -import { call as nearCall } from "../llama-helper/near"; +import { call as nearCall } from "../helper/near"; import { ChainApi } from "@defillama/sdk"; diff --git a/src/adapters/peggedAssets/usd-coin/index.ts b/src/adapters/peggedAssets/usd-coin/index.ts index b6ac089c..d5e46c27 100644 --- a/src/adapters/peggedAssets/usd-coin/index.ts +++ b/src/adapters/peggedAssets/usd-coin/index.ts @@ -19,7 +19,7 @@ import { } from "../helper/ontology"; import { getTotalSupply as kavaGetTotalSupply } from "../helper/kava"; import { getTotalSupply as aptosGetTotalSupply } from "../helper/aptos"; -import { call as nearCall } from "../llama-helper/near"; +import { call as nearCall } from "../helper/near"; import { ChainBlocks, PeggedIssuanceAdapter, @@ -30,7 +30,7 @@ import { } from "../helper/tron"; import { mixinSupply } from "../helper/mixin"; import { chainContracts } from "./config"; -import { lookupAccountByID } from "../llama-helper/algorand"; +import { lookupAccountByID } from "../helper/algorand"; const axios = require("axios"); const retry = require("async-retry"); diff --git a/src/adapters/peggedAssets/usn/index.ts b/src/adapters/peggedAssets/usn/index.ts index cdb7b2be..3163e360 100644 --- a/src/adapters/peggedAssets/usn/index.ts +++ b/src/adapters/peggedAssets/usn/index.ts @@ -5,7 +5,7 @@ import { PeggedIssuanceAdapter, Balances, ChainContracts, } from "../peggedAsset.type"; -import { call } from "../llama-helper/near"; +import { call } from "../helper/near"; import { bridgedSupply } from "../helper/getSupply";