From de8037cd787bb12e5f1221fd3df5346029dad4cf Mon Sep 17 00:00:00 2001 From: RM Date: Mon, 14 Oct 2024 12:57:34 +0800 Subject: [PATCH] Remove reaper vaults prices --- src/api/stats/getAmmPrices.ts | 3 - src/data/optimism/beethovenxLinearPools.json | 125 ---------------- src/data/optimism/beethovenxLpPools.json | 146 ------------------- src/data/optimism/beethovenxSteadyBeets.json | 32 ---- src/utils/fetchBalancerStablePoolPrices.js | 3 +- src/utils/fetchVaultPrices.js | 63 -------- 6 files changed, 1 insertion(+), 371 deletions(-) delete mode 100644 src/data/optimism/beethovenxSteadyBeets.json delete mode 100644 src/utils/fetchVaultPrices.js diff --git a/src/api/stats/getAmmPrices.ts b/src/api/stats/getAmmPrices.ts index 466170136..72825a236 100644 --- a/src/api/stats/getAmmPrices.ts +++ b/src/api/stats/getAmmPrices.ts @@ -86,7 +86,6 @@ import lynexPools from '../../data/linea/lynexVolatilePools.json'; import nilePools from '../../data/linea/nileVolatilePools.json'; import raPools from '../../data/fraxtal/raPools.json'; import velodromeModePools from '../../data/mode/velodromeModePools.json'; -import { fetchVaultPrices } from '../../utils/fetchVaultPrices'; import { addressBookByChainId } from '../../../packages/address-book/src/address-book'; import { sleep } from '../../utils/time'; import { isFiniteNumber } from '../../utils/number'; @@ -505,11 +504,9 @@ async function performUpdateAmmPrices() { const linearPoolPrice = ammPrices.then(async ({ tokenPrices }): Promise> => { const jbrlTokenPrice = await fetchJbrlPrice(); const yVaultPrices = await fetchyVaultPrices(tokenPrices); - const vaultPrices = await fetchVaultPrices(tokenPrices); const wrappedAavePrices = await fetchWrappedAavePrices(tokenPrices); const prices = { ...tokenPrices, - ...vaultPrices, ...wrappedAavePrices, ...jbrlTokenPrice, ...yVaultPrices, diff --git a/src/data/optimism/beethovenxLinearPools.json b/src/data/optimism/beethovenxLinearPools.json index e92ea4e44..acd1c53e3 100644 --- a/src/data/optimism/beethovenxLinearPools.json +++ b/src/data/optimism/beethovenxLinearPools.json @@ -48,130 +48,5 @@ "decimals": "1e18" } ] - }, - { - "name": "bbrfaWETH", - "address": "0xDD89C7cd0613C1557B2DaAC6Ae663282900204f1", - "vault": "0xBA12222222228d8Ba445958a75a0704d566BF2C8", - "vaultPoolId": "0xdd89c7cd0613c1557b2daac6ae663282900204f100000000000000000000003e", - "decimals": "1e18", - "chainId": 10, - "composable": true, - "bptIndex": 1, - "tokens": [ - { - "oracle": "tokens", - "oracleId": "ETH", - "decimals": "1e18" - }, - { - "oracleId": "BPTToken" - }, - { - "oracle": "tokens", - "oracleId": "rfaWETH", - "decimals": "1e18" - } - ] - }, - { - "name": "bbrfaUSDC", - "address": "0xba7834bb3cd2DB888E6A06Fb45E82b4225Cd0C71", - "vault": "0xBA12222222228d8Ba445958a75a0704d566BF2C8", - "vaultPoolId": "0xba7834bb3cd2db888e6a06fb45e82b4225cd0c71000000000000000000000043", - "decimals": "1e18", - "chainId": 10, - "composable": true, - "bptIndex": 2, - "tokens": [ - { - "oracle": "tokens", - "oracleId": "rfaUSDC", - "decimals": "1e18" - }, - { - "oracle": "tokens", - "oracleId": "opUSDCe", - "decimals": "1e6" - }, - { - "oracleId": "BPTToken" - } - ] - }, - { - "name": "bbrfaUSDT", - "address": "0x9253d7e1B42fa01eDE2c53f3A21b3B4d13239cD4", - "vault": "0xBA12222222228d8Ba445958a75a0704d566BF2C8", - "vaultPoolId": "0x9253d7e1b42fa01ede2c53f3a21b3b4d13239cd4000000000000000000000042", - "decimals": "1e18", - "chainId": 10, - "composable": true, - "bptIndex": 1, - "tokens": [ - { - "oracle": "tokens", - "oracleId": "rfaUSDT", - "decimals": "1e18" - }, - { - "oracleId": "BPTToken" - }, - { - "oracle": "tokens", - "oracleId": "USDT", - "decimals": "1e6" - } - ] - }, - { - "name": "bbrfaDAI", - "address": "0x888a6195D42a95e80D81e1c506172772a80b80Bc", - "vault": "0xBA12222222228d8Ba445958a75a0704d566BF2C8", - "vaultPoolId": "0x888a6195d42a95e80d81e1c506172772a80b80bc000000000000000000000044", - "decimals": "1e18", - "chainId": 10, - "composable": true, - "bptIndex": 1, - "tokens": [ - { - "oracle": "tokens", - "oracleId": "rfaDAI", - "decimals": "1e18" - }, - { - "oracleId": "BPTToken" - }, - { - "oracle": "tokens", - "oracleId": "DAI", - "decimals": "1e18" - } - ] - }, - { - "name": "bbrfaWBTC", - "address": "0xA1a77E5d7D769BFBB790a08EC976dc738bF795B9", - "vault": "0xBA12222222228d8Ba445958a75a0704d566BF2C8", - "vaultPoolId": "0xa1a77e5d7d769bfbb790a08ec976dc738bf795b9000000000000000000000047", - "decimals": "1e18", - "chainId": 10, - "composable": true, - "bptIndex": 2, - "tokens": [ - { - "oracle": "tokens", - "oracleId": "rfaWBTC", - "decimals": "1e18" - }, - { - "oracle": "tokens", - "oracleId": "WBTC", - "decimals": "1e8" - }, - { - "oracleId": "BPTToken" - } - ] } ] diff --git a/src/data/optimism/beethovenxLpPools.json b/src/data/optimism/beethovenxLpPools.json index fdc0c0d7c..6b08e8ca9 100644 --- a/src/data/optimism/beethovenxLpPools.json +++ b/src/data/optimism/beethovenxLpPools.json @@ -124,152 +124,6 @@ } ] }, - { - "name": "beets-its-mai-life", - "address": "0x1F131EC1175f023ee1534B16FA8aB237c00e2381", - "vault": "0xBA12222222228d8Ba445958a75a0704d566BF2C8", - "gauge": "0x1bc536D34897603f562d94601d16F67b4d497eBC", - "vaultPoolId": "0x1f131ec1175f023ee1534b16fa8ab237c00e238100000000000000000000004a", - "decimals": "1e18", - "composable": true, - "bptIndex": 0, - "rewards": [ - { - "stream": "0xeCc205dfa8300cEd05955c9aEA930f1A7Ab8DAeb", - "token": "0xFE8B128bA8C78aabC59d4c64cEE7fF28e9379921", - "oracleId": "BAL" - }, - { - "stream": "0xeCc205dfa8300cEd05955c9aEA930f1A7Ab8DAeb", - "token": "0x97513e975a7fA9072c72C92d8000B0dB90b163c5", - "oracleId": "BEETS" - }, - { - "stream": "0xeCc205dfa8300cEd05955c9aEA930f1A7Ab8DAeb", - "token": "0x4200000000000000000000000000000000000042", - "oracleId": "OP" - }, - { - "stream": "0xeCc205dfa8300cEd05955c9aEA930f1A7Ab8DAeb", - "token": "0x3F56e0c36d275367b8C502090EDF38289b3dEa0d", - "oracleId": "QI" - } - ], - "tokens": [ - { - "oracleId": "BPTToken" - }, - { - "oracle": "tokens", - "oracleId": "bbrfaUSD", - "decimals": "1e18" - }, - { - "oracle": "tokens", - "oracleId": "oMAI", - "decimals": "1e18" - } - ] - }, - { - "name": "beets-yellow-submarine", - "address": "0x981Fb05B738e981aC532a99e77170ECb4Bc27AEF", - "vault": "0xBA12222222228d8Ba445958a75a0704d566BF2C8", - "gauge": "0xbd54c9dbd7B4D82c80759790f8c566C3DeAaD6a5", - "vaultPoolId": "0x981fb05b738e981ac532a99e77170ecb4bc27aef00010000000000000000004b", - "decimals": "1e18", - "lidoUrl": "https://eth-api.lido.fi/v1/protocol/steth/apr/sma", - "lsIndex": 0, - "rewards": [ - { - "stream": "0x23D6352Ff0EeC97E37726461EF63C7A8116C12b0", - "token": "0xFE8B128bA8C78aabC59d4c64cEE7fF28e9379921", - "oracleId": "BAL" - }, - { - "stream": "0x23D6352Ff0EeC97E37726461EF63C7A8116C12b0", - "token": "0x97513e975a7fA9072c72C92d8000B0dB90b163c5", - "oracleId": "BEETS" - }, - { - "stream": "0x23D6352Ff0EeC97E37726461EF63C7A8116C12b0", - "token": "0x4200000000000000000000000000000000000042", - "oracleId": "OP" - }, - { - "stream": "0x23D6352Ff0EeC97E37726461EF63C7A8116C12b0", - "token": "0xFdb794692724153d1488CcdBE0C56c252596735F", - "oracleId": "LDO" - } - ], - "tokens": [ - { - "oracle": "tokens", - "oracleId": "wstETH", - "decimals": "1e18" - }, - { - "oracle": "tokens", - "oracleId": "bbrfaUSD", - "decimals": "1e18" - }, - { - "oracle": "tokens", - "oracleId": "bbrfaWBTC", - "decimals": "1e18" - } - ] - }, - { - "name": "beets-lido-shuffle", - "address": "0xde45F101250f2ca1c0f8adFC172576d10c12072D", - "vault": "0xBA12222222228d8Ba445958a75a0704d566BF2C8", - "gauge": "0x950FdBEE03900487Ebc3aC54daf4C988E7C02678", - "vaultPoolId": "0xde45f101250f2ca1c0f8adfc172576d10c12072d00000000000000000000003f", - "lidoUrl": "https://eth-api.lido.fi/v1/protocol/steth/apr/sma", - "lsIndex": 0, - "balancerChargesFee": true, - "decimals": "1e18", - "composable": true, - "bptIndex": 2, - "rewards": [ - { - "stream": "0x49478499Dd1bA1b8A763dDc747661898C0f7C269", - "token": "0xFE8B128bA8C78aabC59d4c64cEE7fF28e9379921", - "oracleId": "BAL" - }, - { - "stream": "0x49478499Dd1bA1b8A763dDc747661898C0f7C269", - "token": "0x97513e975a7fA9072c72C92d8000B0dB90b163c5", - "oracleId": "BEETS" - }, - { - "stream": "0x49478499Dd1bA1b8A763dDc747661898C0f7C269", - "token": "0x4200000000000000000000000000000000000042", - "oracleId": "OP" - }, - { - "stream": "0x49478499Dd1bA1b8A763dDc747661898C0f7C269", - "token": "0xFdb794692724153d1488CcdBE0C56c252596735F", - "oracleId": "LDO" - } - ], - "tokens": [ - { - "oracle": "tokens", - "oracleId": "wstETH", - "decimals": "1e18" - }, - { - "oracle": "tokens", - "oracleId": "bbrfaWETH", - "decimals": "1e18" - }, - { - "oracleId": "BPTToken" - } - ] - }, { "name": "beets-lennons-long", "address": "0x5028497af0c9a54ea8C6D42a054c0341B9fc6168", diff --git a/src/data/optimism/beethovenxSteadyBeets.json b/src/data/optimism/beethovenxSteadyBeets.json deleted file mode 100644 index 59257e4e9..000000000 --- a/src/data/optimism/beethovenxSteadyBeets.json +++ /dev/null @@ -1,32 +0,0 @@ -[ - { - "name": "bbrfaUSD", - "address": "0x6222ae1d2a9f6894dA50aA25Cb7b303497f9BEbd", - "vault": "0xBA12222222228d8Ba445958a75a0704d566BF2C8", - "vaultPoolId": "0x6222ae1d2a9f6894da50aa25cb7b303497f9bebd000000000000000000000046", - "decimals": "1e18", - "chainId": 10, - "composable": true, - "bptIndex": 0, - "tokens": [ - { - "oracleId": "BPTToken" - }, - { - "oracle": "tokens", - "oracleId": "bbrfaDAI", - "decimals": "1e18" - }, - { - "oracle": "tokens", - "oracleId": "bbrfaUSDT", - "decimals": "1e18" - }, - { - "oracle": "tokens", - "oracleId": "bbrfaUSDC", - "decimals": "1e18" - } - ] - } -] diff --git a/src/utils/fetchBalancerStablePoolPrices.js b/src/utils/fetchBalancerStablePoolPrices.js index f093629e4..6504ac2eb 100644 --- a/src/utils/fetchBalancerStablePoolPrices.js +++ b/src/utils/fetchBalancerStablePoolPrices.js @@ -1,5 +1,4 @@ import getBalancerPrices from '../api/stats/common/balancer/getBalancerPrices'; -import beetsPools from '../data/optimism/beethovenxSteadyBeets.json'; import bbaUSD from '../data/ethereum/bbaUSD.json'; import bbamUSD from '../data/matic/bbamUSD.json'; import bbaaUSD from '../data/arbitrum/bbaaUSD.json'; @@ -9,7 +8,7 @@ import balancerPolyLinearPools from '../data/matic/balancerLinearPools.json'; import balancerArbLinearPools from '../data/arbitrum/balancerLinearPools.json'; import balancerBaseLinearPools from '../data/base/balancerLinearPools.json'; -const stablePoolPools = [...beetsPools, ...bbaUSD, ...bbamUSD, ...bbaaUSD]; +const stablePoolPools = [...bbaUSD, ...bbamUSD, ...bbaaUSD]; const linearPoolPools = [ ...beetsLinearPools, ...balancerLinearPools, diff --git a/src/utils/fetchVaultPrices.js b/src/utils/fetchVaultPrices.js deleted file mode 100644 index 313eaa76c..000000000 --- a/src/utils/fetchVaultPrices.js +++ /dev/null @@ -1,63 +0,0 @@ -import BigNumber from 'bignumber.js'; -import { getEDecimals } from './getEDecimals'; -import { OPTIMISM_CHAIN_ID } from '../constants'; -import { addressBook } from '../../packages/address-book/src/address-book'; -import { fetchContract } from '../api/rpc/client'; -import BeefyVaultV6Abi from '../abis/BeefyVault'; - -const { - optimism: { - tokens: { ETH, rfaWETH, USDC, rfaUSDC, DAI, rfaDAI, WBTC, rfaWBTC, USDT, rfaUSDT }, - }, -} = addressBook; - -const tokens = { - optimism: [ - [ETH, rfaWETH], - [USDC, rfaUSDC], - [DAI, rfaDAI], - [WBTC, rfaWBTC], - [USDT, rfaUSDT], - ], -}; - -const getVaultPrices = async (tokenPrices, tokens, chainId) => { - const [balanceCalls, totalSupplyCalls, decimals] = tokens.reduce( - (acc, token) => { - const tokenContract = fetchContract(token[1].address, BeefyVaultV6Abi, chainId); - acc[0].push(tokenContract.read.balance()); - acc[1].push(tokenContract.read.totalSupply()); - acc[2].push(getEDecimals(token[0].decimals)); - return acc; - }, - [[], [], []] - ); - - let res; - try { - res = await Promise.all([Promise.all(balanceCalls), Promise.all(totalSupplyCalls)]); - } catch (e) { - console.error('getVaultPrices', e); - return tokens.map(() => 0); - } - const balanceOfPool = res[0].map(v => new BigNumber(v.toString())); - const totalSupply = res[1].map(v => new BigNumber(v.toString())); - - return balanceOfPool.map((v, i) => - v - .times('1e18') - .times(tokenPrices[tokens[i][0].oracleId]) - .dividedBy(totalSupply[i]) - .dividedBy(decimals[i]) - .toNumber() - ); -}; - -const fetchVaultPrices = async tokenPrices => - Promise.all([getVaultPrices(tokenPrices, tokens.optimism, OPTIMISM_CHAIN_ID)]).then(data => - data - .flat() - .reduce((acc, cur, i) => ((acc[Object.values(tokens).flat()[i][1].oracleId] = cur), acc), {}) - ); - -export { fetchVaultPrices };