Skip to content

Commit

Permalink
split eddyfinance by product
Browse files Browse the repository at this point in the history
  • Loading branch information
realdealshaman committed Oct 17, 2024
1 parent d80c884 commit b7ab703
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 3 deletions.
37 changes: 37 additions & 0 deletions projects/eddyfinance-stableswap/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
const { getUniTVL } = require('../helper/unknownTokens')
const sdk = require('@defillama/sdk');
const { sumTokens2 } = require('../helper/unwrapLPs');

const getReserves = 'function getReserves() view returns (uint112 _reserve0, uint112 _reserve1)';

const stablePools = [
'0x448028804461e8e5a8877c228F3adFd58c3Da6B6', // 4 asset pool
'0x01a9cd602c6c3f05ea9a3a55184c2181bd43e4b8', // 2 asset pool accumulated finance
'0xee1629de70afaf3ae3592a9d6d859949750aa697', // 2 asset pool zearn
'0x89cb3fA2A7910A268e9f7F619108aFADBD7587c4' // 2 asset UltiVerse pool
]

async function stableSwapTvl(api) {
const params = [0, 1, 2, 3]
const calls = []
stablePools.forEach(pool => {
params.forEach(param =>
calls.push({ target: pool, params: param }))
})
const tokens = await api.multiCall({ abi: 'function coins(uint256) view returns (address)', calls, permitFailure: true })
const tokensAndOwners = []
tokens.forEach((token, i) => {
if (!token) return;
tokensAndOwners.push([token, calls[i].target])
})

return sumTokens2({ api, tokensAndOwners, blacklistedTokens: stablePools })
}



module.exports = {
misrepresentedTokens: true,
methodology: "Sum of tvl of the StableSwap pools",
zeta: { tvl: stableSwapTvl },
};
7 changes: 4 additions & 3 deletions projects/eddyfinance/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const sdk = require('@defillama/sdk');
const { sumTokens2 } = require('../helper/unwrapLPs');

const getReserves = 'function getReserves() view returns (uint112 _reserve0, uint112 _reserve1)';

/*
const stablePools = [
'0x448028804461e8e5a8877c228F3adFd58c3Da6B6', // 4 asset pool
'0x01a9cd602c6c3f05ea9a3a55184c2181bd43e4b8', // 2 asset pool accumulated finance
Expand All @@ -27,11 +27,12 @@ async function stableSwapTvl(api) {
return sumTokens2({ api, tokensAndOwners, blacklistedTokens: stablePools })
}
*/ // separate into eddyfinance-stableswap adapter

const uniTvl = getUniTVL({ factory: '0x9fd96203f7b22bCF72d9DCb40ff98302376cE09c', abis: { getReserves } })

module.exports = {
misrepresentedTokens: true,
methodology: "Sum of tvl of UniV2 pools and StableSwap pools",
zeta: { tvl: sdk.util.sumChainTvls([uniTvl, stableSwapTvl]) },
methodology: "Sum of tvl of UniV2 pools",
zeta: { tvl: uniTvl },
};

0 comments on commit b7ab703

Please sign in to comment.