From 9bef2f35c91e50812b29c1b2bd8c82eba439d4b6 Mon Sep 17 00:00:00 2001 From: Define101 <93603962+Define101@users.noreply.github.com> Date: Fri, 20 Sep 2024 13:48:57 +0100 Subject: [PATCH] Revert "add ck aggregator (#11619)" This reverts commit 5435936e6ccfa17f3899c8631ad8d47e8c27627e. --- projects/chain-fusion/index.js | 27 --------------------------- projects/ckbtc/index.js | 16 ++++++++++++++++ projects/cketh/index.js | 21 +++++++++++++++++++++ 3 files changed, 37 insertions(+), 27 deletions(-) delete mode 100644 projects/chain-fusion/index.js create mode 100644 projects/ckbtc/index.js create mode 100644 projects/cketh/index.js diff --git a/projects/chain-fusion/index.js b/projects/chain-fusion/index.js deleted file mode 100644 index 80c79de0d0b..00000000000 --- a/projects/chain-fusion/index.js +++ /dev/null @@ -1,27 +0,0 @@ -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 }, -}; diff --git a/projects/ckbtc/index.js b/projects/ckbtc/index.js new file mode 100644 index 00000000000..94bca327672 --- /dev/null +++ b/projects/ckbtc/index.js @@ -0,0 +1,16 @@ +const { get } = require('../helper/http') + +async function 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 BTC as the collateral for the ckBTC`, + bitcoin: { tvl: tvl }, +} diff --git a/projects/cketh/index.js b/projects/cketh/index.js new file mode 100644 index 00000000000..0a12acb9731 --- /dev/null +++ b/projects/cketh/index.js @@ -0,0 +1,21 @@ +const { sumTokens2, nullAddress } = require("../helper/unwrapLPs"); +// const { get } = require('../helper/http') +const ADDRESSES = require('../helper/coreAssets.json') + +const contract = "0xb25eA1D493B49a1DeD42aC5B1208cC618f9A9B80"; + +async function tvl(api) { + // var end = api.timestamp + // let start = end - 24 * 60 * 60; + // const { data } = await get(`https://icrc-api.internetcomputer.org/api/v1/ledgers/xevnm-gaaaa-aaaar-qafnq-cai/total-supply?start=${start}&end=${end}&step=1`); + // let [_, bal] = data.pop() + // api.add(ADDRESSES.ethereum.USDC, bal/1e2) + return sumTokens2({ tokens: [nullAddress, ADDRESSES.ethereum.USDC], owner: contract, api }); +} + +module.exports = { + methodology: `We count the ETH on ${contract} as the collateral for the ckETH`, + ethereum: { + tvl, + }, +}; \ No newline at end of file