From 911bc8235866b8f1fcb55f5e9228496d3859eb08 Mon Sep 17 00:00:00 2001 From: g1nt0ki <99907941+g1nt0ki@users.noreply.github.com> Date: Mon, 6 Jan 2025 12:18:29 +0100 Subject: [PATCH] update fx #12949 --- projects/fx-Protocol/index.js | 34 +++++++++++++++------------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/projects/fx-Protocol/index.js b/projects/fx-Protocol/index.js index 914f8e1235..a3943238dc 100644 --- a/projects/fx-Protocol/index.js +++ b/projects/fx-Protocol/index.js @@ -1,12 +1,12 @@ const ADDRESSES = require('../helper/coreAssets.json') const treasuries = [ - "0x0e5CAA5c889Bdf053c9A76395f62267E653AFbb0", - "0xED803540037B0ae069c93420F89Cd653B6e3Df1f", - "0xcfEEfF214b256063110d3236ea12Db49d2dF2359", - "0x781BA968d5cc0b40EB592D5c8a9a3A4000063885", - "0x38965311507D4E54973F81475a149c09376e241e", - "0x63Fe55B3fe3f74B42840788cFbe6229869590f83", - "0xdFac83173A96b06C5D6176638124d028269cfCd2" + "0x0e5CAA5c889Bdf053c9A76395f62267E653AFbb0", + "0xED803540037B0ae069c93420F89Cd653B6e3Df1f", + "0xcfEEfF214b256063110d3236ea12Db49d2dF2359", + "0x781BA968d5cc0b40EB592D5c8a9a3A4000063885", + "0x38965311507D4E54973F81475a149c09376e241e", + "0x63Fe55B3fe3f74B42840788cFbe6229869590f83", + "0xdFac83173A96b06C5D6176638124d028269cfCd2" ]; const baseTokenRate = [ // '', @@ -21,6 +21,9 @@ const cvxAddress = ADDRESSES.ethereum.CVX; const aCVX = "0xb0903Ab70a7467eE5756074b31ac88aEBb8fB777"; const uniBTC = "0x004E9C3EF86bc1ca1f0bB5C7662861Ee93350568"; const uniBTC_Genesis_Gauge = "0x1D20671A21112E85b03B00F94Fd760DE0Bef37Ba" +const fxUSD_stabilityPool = "0x65C9A641afCEB9C0E6034e558A319488FA0FA3be" +const fxUSD_stabilityPool_Gauge = "0xEd92dDe3214c24Ae04F5f96927E3bE8f8DbC3289" + module.exports = { doublecounted: true, ethereum: { @@ -42,14 +45,6 @@ async function getACVXInfo(api) { return totalAssets / totalSupply } -async function getUniBTCTvl(api) { - const totalSupply = await api.api.call( - { - target: uniBTC_Genesis_Gauge, - abi: 'uint256:totalSupply', - }) - return totalSupply -} async function getBaseTokenRate(api) { const rates = await api.multiCall({ abi: 'uint256:getRate', calls: baseTokenRate }) rates.splice(0, 0, 1e18); @@ -63,13 +58,14 @@ async function tvl(api) { const tokens = await api.multiCall({ abi: 'address:baseToken', calls: treasuries }) const bals = await api.multiCall({ abi: 'uint256:totalBaseToken', calls: treasuries }) const decimals = await api.multiCall({ abi: 'erc20:decimals', calls: tokens }) - const uniBTCTvl = await getUniBTCTvl(api) bals.forEach((bal, i) => { if (tokens[i].toLowerCase() === aCVX.toLowerCase()) { - api.add(cvxAddress, bal/(rates[i]/1e18)*aCvxRate / 10 ** (18 - decimals[i])) + api.add(cvxAddress, bal / (rates[i] / 1e18) * aCvxRate / 10 ** (18 - decimals[i])) } else { - api.add(tokens[i], bal/(rates[i]/1e18) / 10 ** (18 - decimals[i])) + api.add(tokens[i], bal / (rates[i] / 1e18) / 10 ** (18 - decimals[i])) } }) - api.add(uniBTC, uniBTCTvl) + + const tokensAndOwners = [[uniBTC, uniBTC_Genesis_Gauge], [ADDRESSES.ethereum.USDC, fxUSD_stabilityPool]] + return api.sumTokens({ tokensAndOwners }) } \ No newline at end of file