Skip to content

Commit

Permalink
update fx #12949
Browse files Browse the repository at this point in the history
  • Loading branch information
g1nt0ki committed Jan 6, 2025
1 parent 97f5236 commit 911bc82
Showing 1 changed file with 15 additions and 19 deletions.
34 changes: 15 additions & 19 deletions projects/fx-Protocol/index.js
Original file line number Diff line number Diff line change
@@ -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 = [
// '',
Expand All @@ -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: {
Expand All @@ -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);
Expand All @@ -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 })
}

0 comments on commit 911bc82

Please sign in to comment.