Skip to content

Commit

Permalink
Oracle update - adding mBASIS token to TVL (#11696)
Browse files Browse the repository at this point in the history
Co-authored-by: g1nt0ki <[email protected]>
  • Loading branch information
ahorner2 and g1nt0ki authored Sep 23, 2024
1 parent 6843299 commit d42fb82
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions projects/midas/index.js
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
async function tvl(api) {
const MTBILL_TOKEN_CONTRACT = "0xDD629E5241CbC5919847783e6C96B2De4754e438";
const mtbillSupply = await await api.call({ abi: "erc20:totalSupply", target: MTBILL_TOKEN_CONTRACT, })

const rate = await api.call({
target: "0x056339C044055819E8Db84E71f5f2E1F536b2E5b", // midas oracle
abi: "function latestRoundData() external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound)",
});
api.addCGToken("tether", (mtbillSupply / 1e18) * ((rate.answer / 1e8)))
const config = {
ethereum: {
mTBILL: '0xDD629E5241CbC5919847783e6C96B2De4754e438',
mBASIS: '0x2a8c22E3b10036f3AEF5875d04f8441d4188b656',
}
}

const chains = ["ethereum"];
async function tvl(api) {
const tokens = Object.values(config[api.chain])
const bals = await api.multiCall({ abi: 'uint256:totalSupply', calls: tokens})
api.add(tokens, bals)
}

chains.forEach((chain) => {
module.exports[chain] = { tvl };
});

module.exports.misrepresentedTokens = true
Object.keys(config).forEach((chain) => {
module.exports[chain] = { tvl }
})

0 comments on commit d42fb82

Please sign in to comment.