-
Notifications
You must be signed in to change notification settings - Fork 5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Oracle update - adding mBASIS token to TVL (#11696)
Co-authored-by: g1nt0ki <[email protected]>
- Loading branch information
Showing
1 changed file
with
13 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 } | ||
}) |