Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 19 additions & 8 deletions projects/lunarbase/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,26 @@

const CURVE_PMMS = [
"0x6Ccc8223532fff07f47EF4311BEB3647326894Ab",
"0x000027B106df9f417980Bc4EdaDD1087c6f01B99",
];

async function tvl(api) {
const ownerTokens = await Promise.all(CURVE_PMMS.map(async (pool) => {
const [tokenX, tokenY] = await Promise.all([
api.call({ abi: 'address:X', target: pool }),
api.call({ abi: 'address:Y', target: pool }),
]);
return [[tokenX, tokenY], pool];
}));

await api.sumTokens({ ownerTokens });
return api.getBalances();
}

module.exports = {
methodology:
"TVL is the total value of tokens held in the LunarBase CurvePMM pool contract on Base.",
"TVL is the total value of tokens held across LunarBase CurvePMM pool contracts on Base.",
base: {
tvl: async (api) => {
// CurvePMM pool on Base — holds all reserves (tradable + LP + fees)
const CURVE_PMM = "0x6Ccc8223532fff07f47EF4311BEB3647326894Ab";
const tokenX = await api.call({ abi: 'address:X', target: CURVE_PMM });
const tokenY = await api.call({ abi: 'address:Y', target: CURVE_PMM });
return api.sumTokens({ owner: CURVE_PMM, tokens: [tokenX, tokenY] });
},
tvl,
},
}
Loading