Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat(add moonlander) #12889

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
32 changes: 32 additions & 0 deletions projects/moonlander/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const { sumTokens2 } = require("../helper/unwrapLPs");

const CRO_ZKEVM_MOONLANDER_ADDR = '0x02ae2e56bfDF1ee4667405eE7e959CD3fE717A05';

function tvl({moonlander,}) {
return async (api) => {
const poolTokens = await api.call({
abi: abis.totalValue,
target: moonlander,
})

const addresses = [];
const valuesUsd = [];

poolTokens.forEach((poolToken) => {
addresses.push(poolToken.tokenAddress);
valuesUsd.push(poolToken.valueUsd);
});

return sumTokens2({ api, owner: moonlander, tokens: addresses, balances: valuesUsd})
}
}

const abis = {
totalValue: 'function totalValue() view returns (tuple(address tokenAddress, int256 value, uint8 decimals, int256 valueUsd, uint16 targetWeight, uint16 feeBasisPoints, uint16 taxBasisPoints, bool dynamicFee)[])'
}

module.exports = {
cronos_zkevm: {
tvl: tvl({ moonlander: CRO_ZKEVM_MOONLANDER_ADDR, }),
},
}
Loading