-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Revert "add ck aggregator"" (#11694)
- Loading branch information
Showing
3 changed files
with
27 additions
and
37 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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
const { sumTokens2, } = require("../helper/unwrapLPs"); | ||
const { get } = require('../helper/http') | ||
|
||
// This address holds all the locked ETH as well as locked ERC20 tokens | ||
const ethereum_contract = "0xb25eA1D493B49a1DeD42aC5B1208cC618f9A9B80"; | ||
|
||
async function ethereum_tvl(api) { | ||
return sumTokens2({ owner: ethereum_contract, api, fetchCoValentTokens: true }); | ||
} | ||
|
||
async function bitcoin_tvl(ts) { | ||
var end = ts.timestamp | ||
let start = end - 24 * 60 * 60; | ||
const { data } = await get(`https://icrc-api.internetcomputer.org/api/v1/ledgers/mxzaz-hqaaa-aaaar-qaada-cai/total-supply?start=${start}&end=${end}&step=1`); | ||
let [_, bal] = data.pop() | ||
return { | ||
'coingecko:bitcoin': bal / 1e8 | ||
}; | ||
} | ||
|
||
module.exports = { | ||
methodology: `We count the ETH and ERC20-Tokens on ${ethereum_contract} as the collateral for ckETH and ck-ERC20 tokens and we count BTC as the collateral for ckBTC`, | ||
ethereum: { | ||
tvl: ethereum_tvl, | ||
}, | ||
bitcoin: { tvl: bitcoin_tvl }, | ||
}; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.